org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface类的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(14.2k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface类的一些代码示例,展示了Interface类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interface类的具体详情如下:
包路径:org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
类名称:Interface

Interface介绍

[英]The list of configured interfaces on the device. The operational state of an interface is available in the /interfaces-state/interface list. If the configuration of a system-controlled interface cannot be used by the system (e.g., the interface hardware present does not match the interface type), then the configuration is not applied to the system-controlled interface shown in /interfaces-state/interface list. If the configuration of a user-controlled interface cannot be used by the system, the configured interface is not instantiated in the /interfaces-state/interface list.

This class represents the following YANG schema fragment defined in module ietf-interfaces

  1. list interface {
  2. key "name"
  3. leaf name {
  4. type string;
  5. }
  6. leaf description {
  7. type string;
  8. }
  9. leaf type {
  10. type identityref;
  11. }
  12. leaf enabled {
  13. type enabled;
  14. }
  15. leaf link-up-down-trap-enable {
  16. type enumeration;
  17. }
  18. }

The schema path to identify an instance is ietf-interfaces/interfaces/interface

To create instances of this class use org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder.
[中]设备上已配置接口的列表。接口的操作状态在/interfaces state/interface列表中可用。如果系统无法使用系统控制接口的配置(例如,存在的接口硬件与接口类型不匹配),则该配置不会应用于/interfaces state/interface list中显示的系统控制接口。如果系统无法使用用户控制接口的配置,则配置的接口不会在/interfaces state/interface列表中实例化。
此类表示模块ietf接口中定义的以下模式片段

  1. list interface {
  2. key "name"
  3. leaf name {
  4. type string;
  5. }
  6. leaf description {
  7. type string;
  8. }
  9. leaf type {
  10. type identityref;
  11. }
  12. leaf enabled {
  13. type enabled;
  14. }
  15. leaf link-up-down-trap-enable {
  16. type enumeration;
  17. }
  18. }

标识实例的模式路径是ietf接口/接口/接口
要创建此类的实例,请使用org。露天采光。杨。第1代。瓮。ietf。params。xml。纳什。杨。ietf。接口。rev140508。接口。接口生成器。

代码示例

代码示例来源:origin: org.opendaylight.mdsal.model/ietf-interfaces

  1. if (!Objects.equals(_description, other.getDescription())) {
  2. return false;
  3. if (!Objects.equals(_key, other.getKey())) {
  4. return false;
  5. if (!Objects.equals(_linkUpDownTrapEnable, other.getLinkUpDownTrapEnable())) {
  6. return false;
  7. if (!Objects.equals(_name, other.getName())) {
  8. return false;
  9. if (!Objects.equals(_type, other.getType())) {
  10. return false;
  11. if (!Objects.equals(_enabled, other.isEnabled())) {
  12. return false;
  13. if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
  14. return false;

代码示例来源:origin: org.opendaylight.mdsal.binding.model.ietf/rfc7223

  1. if (!Objects.equals(_description, other.getDescription())) {
  2. return false;
  3. if (!Objects.equals(_linkUpDownTrapEnable, other.getLinkUpDownTrapEnable())) {
  4. return false;
  5. if (!Objects.equals(_name, other.getName())) {
  6. return false;
  7. if (!Objects.equals(_type, other.getType())) {
  8. return false;
  9. if (!Objects.equals(_enabled, other.isEnabled())) {
  10. return false;
  11. if (!e.getValue().equals(other.augmentation(e.getKey()))) {
  12. return false;

代码示例来源:origin: io.fd.honeycomb.vpp/vpp-translate-utils

  1. /**
  2. * Check the type of interface equals expected type
  3. *
  4. * @throws IllegalInterfaceTypeException if type of interface is null or not expected
  5. */
  6. static void checkInterfaceType(@Nonnull final Interface ifc,
  7. @Nonnull final Class<? extends InterfaceType> expectedType) {
  8. if (ifc.getType() == null || !expectedType.equals(ifc.getType())) {
  9. throw new IllegalInterfaceTypeException(String.format(
  10. "Unexpected interface type: %s for interface: %s. Expected interface is: %s", ifc.getType(),
  11. ifc.getName(), expectedType));
  12. }
  13. }

代码示例来源:origin: org.opendaylight.mdsal.binding.model.ietf/rfc7223

  1. public InterfaceBuilder(Interface base) {
  2. this.key = base.key();
  3. this._name = base.getName();
  4. this._description = base.getDescription();
  5. this._linkUpDownTrapEnable = base.getLinkUpDownTrapEnable();
  6. this._type = base.getType();
  7. this._enabled = base.isEnabled();
  8. if (base instanceof InterfaceImpl) {
  9. InterfaceImpl impl = (InterfaceImpl) base;
  10. if (!impl.augmentation.isEmpty()) {
  11. this.augmentation = new HashMap<>(impl.augmentation);
  12. }
  13. } else if (base instanceof AugmentationHolder) {
  14. @SuppressWarnings("unchecked")
  15. Map<Class<? extends Augmentation<Interface>>, Augmentation<Interface>> aug =((AugmentationHolder<Interface>) base).augmentations();
  16. if (!aug.isEmpty()) {
  17. this.augmentation = new HashMap<>(aug);
  18. }
  19. }
  20. }

代码示例来源:origin: org.opendaylight.netvirt/aclservice-impl

  1. public static List<AllowedAddressPairs> getPortAllowedAddresses(Interface port) {
  2. if (port == null) {
  3. LOG.error("Port is Null");
  4. return null;
  5. }
  6. InterfaceAcl aclInPort = port.getAugmentation(InterfaceAcl.class);
  7. if (aclInPort == null) {
  8. LOG.error("getSecurityGroupInPortList: no security group associated to Interface port: {}", port.getName());
  9. return null;
  10. }
  11. return aclInPort.getAllowedAddressPairs();
  12. }

代码示例来源:origin: org.opendaylight.vpnservice/nexthopmgr-impl

  1. @Override
  2. protected void add(InstanceIdentifier<Interface> identifier, Interface intrf) {
  3. LOG.trace("Adding Interface : key: " + identifier + ", value=" + intrf );
  4. if (intrf.getType().equals(L3tunnel.class)) {
  5. IfL3tunnel intfData = intrf.getAugmentation(IfL3tunnel.class);
  6. IpAddress gatewayIp = intfData.getGatewayIp();
  7. IpAddress remoteIp = (gatewayIp == null) ? intfData.getRemoteIp() : gatewayIp;
  8. NodeConnectorId ofPort = intrf.getAugmentation(BaseIds.class).getOfPortId();
  9. nexthopManager.createRemoteNextHop(intrf.getName(), ofPort.toString(), remoteIp.getIpv4Address().getValue());
  10. }
  11. }

代码示例来源:origin: org.opendaylight.genius/itm-impl

  1. public void addInterface(Interface iface) {
  2. this.interfaces.put(iface.getName(), iface);
  3. }

代码示例来源:origin: org.opendaylight.genius/interfacemanager-shell

  1. public static void showVlanOutput(InterfaceInfo ifaceInfo, Interface iface) {
  2. StringBuilder sb = new StringBuilder();
  3. Formatter fmt = new Formatter(sb);
  4. IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
  5. int vlanId = l2vlan != null ? l2vlan.getVlanId() != null ? l2vlan.getVlanId().getValue() : 0 : 0;
  6. System.out.println(fmt.format(VLAN_OUTPUT_FORMAT_LINE1,
  7. iface.getName()));
  8. sb.setLength(0);
  9. System.out.println(fmt.format(VLAN_OUTPUT_FORMAT,
  10. "", (ifaceInfo == null) ? UNSET : ifaceInfo.getDpId(),
  11. (ifaceInfo == null) ? UNSET : ifaceInfo.getPortName(), vlanId));
  12. sb.setLength(0);
  13. System.out.println(fmt.format(VLAN_OUTPUT_FORMAT,
  14. (ifaceInfo == null) ? UNSET : ifaceInfo.getInterfaceTag(),
  15. (ifaceInfo == null) ? UNSET : ifaceInfo.getPortNo(),
  16. (ifaceInfo == null) ? UNSET : ifaceInfo.getAdminState(),
  17. (ifaceInfo == null) ? UNSET : ifaceInfo.getOpState()));
  18. sb.setLength(0);
  19. System.out.println(fmt.format(VLAN_OUTPUT_FORMAT + "\n",
  20. iface.getDescription(), "", "", ""));
  21. sb.setLength(0);
  22. fmt.close();
  23. }

代码示例来源:origin: org.opendaylight.netvirt/elanmanager-impl

  1. public static boolean isExternal(
  2. org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
  3. .ietf.interfaces.rev140508.interfaces.Interface iface) {
  4. if (iface == null) {
  5. return false;
  6. }
  7. IfExternal ifExternal = iface.getAugmentation(IfExternal.class);
  8. return ifExternal != null && Boolean.TRUE.equals(ifExternal.isExternal());
  9. }

代码示例来源:origin: org.opendaylight.vpnservice/alivenessmonitor-impl

  1. private List<ActionInfo> getInterfaceActions(String interfaceName, long portNum) throws InterruptedException, ExecutionException {
  2. Class<? extends InterfaceType> intfType;
  3. org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface interfaceInfo =
  4. getInterfaceFromConfigDS(interfaceName);
  5. if(interfaceInfo != null) {
  6. intfType = interfaceInfo.getType();
  7. } else {
  8. LOG.error("Could not retrieve port type for interface {} to construct actions", interfaceName);
  9. return Collections.emptyList();
  10. }
  11. List<ActionInfo> actionInfos = new ArrayList<ActionInfo>();
  12. // Set the LLDP service Id which is 0
  13. if(Tunnel.class.equals(intfType)) {
  14. actionInfos.add(new ActionInfo(ActionType.set_field_tunnel_id, new BigInteger[] {
  15. BigInteger.valueOf(0)}));
  16. }
  17. actionInfos.add(new ActionInfo(ActionType.output, new String[] { Long.toString(portNum) }));
  18. return actionInfos;
  19. }

代码示例来源:origin: io.fd.hc2vpp.v3po/v3po2vpp

  1. private void setInterfaceAttributes(final InstanceIdentifier<Interface> id, final Interface swIf,
  2. final String swIfName, final WriteContext writeContext)
  3. throws WriteFailedException {
  4. setInterfaceFlags(id, swIfName, interfaceContext.getIndex(swIfName, writeContext.getMappingContext()),
  5. swIf.isEnabled()
  6. ? (byte) 1
  7. : (byte) 0);
  8. }

代码示例来源:origin: io.fd.hc2vpp.v3po/v3po2vpp

  1. /**
  2. * Returns true if interface does not have v4/v6 addresses configured
  3. */
  4. private boolean isAddressNotPresentForInterface(@Nonnull final InstanceIdentifier<Routing> id,
  5. @Nonnull final WriteContext ctx,
  6. boolean checkBefore) {
  7. final Optional<Interface> interfaceData = checkBefore
  8. ? ctx.readBefore(RWUtils.cutId(id, Interface.class))
  9. : ctx.readAfter(RWUtils.cutId(id, Interface.class));
  10. if (interfaceData.isPresent()) {
  11. final java.util.Optional<Interface1> augData = java.util.Optional.of(interfaceData.get())
  12. .map(iface -> iface.augmentation(Interface1.class));
  13. final boolean v4NotPresent =
  14. augData.map(Interface1::getIpv4).map(Ipv4::getAddress).map(List::isEmpty).orElse(true);
  15. final boolean v6NotPresent =
  16. augData.map(Interface1::getIpv6).map(Ipv6::getAddress).map(List::isEmpty).orElse(true);
  17. return v4NotPresent && v6NotPresent;
  18. }
  19. return true;
  20. }
  21. }

代码示例来源:origin: org.opendaylight.mdsal.model/ietf-interfaces

  1. public InterfaceBuilder(Interface base) {
  2. if (base.getKey() == null) {
  3. this._key = new InterfaceKey(
  4. base.getName()
  5. );
  6. this._name = base.getName();
  7. } else {
  8. this._key = base.getKey();
  9. this._name = _key.getName();
  10. }
  11. this._description = base.getDescription();
  12. this._linkUpDownTrapEnable = base.getLinkUpDownTrapEnable();
  13. this._type = base.getType();
  14. this._enabled = base.isEnabled();
  15. if (base instanceof InterfaceImpl) {
  16. InterfaceImpl impl = (InterfaceImpl) base;
  17. if (!impl.augmentation.isEmpty()) {
  18. this.augmentation = new HashMap<>(impl.augmentation);
  19. }
  20. } else if (base instanceof AugmentationHolder) {
  21. @SuppressWarnings("unchecked")
  22. AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface>) base;
  23. if (!casted.augmentations().isEmpty()) {
  24. this.augmentation = new HashMap<>(casted.augmentations());
  25. }
  26. }
  27. }

代码示例来源:origin: org.opendaylight.netvirt/aclservice-impl

  1. @Override
  2. protected void add(InstanceIdentifier<Interface> key, Interface port) {
  3. InterfaceAcl aclInPort = port.getAugmentation(InterfaceAcl.class);
  4. if (aclInPort != null && aclInPort.isPortSecurityEnabled()) {
  5. addAclInterfaceToCache(port.getName(), aclInPort);
  6. }
  7. }

代码示例来源:origin: org.opendaylight.vpnservice/nexthopmgr-impl

  1. @Override
  2. protected void remove(InstanceIdentifier<Interface> identifier,
  3. Interface intrf) {
  4. LOG.trace("Removing interface : key: " + identifier + ", value=" + intrf );
  5. if (intrf.getType().equals(L3tunnel.class)) {
  6. BigInteger dpnId = interfaceManager.getDpnForInterface(intrf);
  7. IfL3tunnel intfData = intrf.getAugmentation(IfL3tunnel.class);
  8. IpAddress gatewayIp = intfData.getGatewayIp();
  9. IpAddress remoteIp = (gatewayIp == null) ? intfData.getRemoteIp() : gatewayIp;
  10. nexthopManager.removeRemoteNextHop(dpnId, intrf.getName(), remoteIp.getIpv4Address().getValue());
  11. }
  12. }

代码示例来源:origin: io.fd.honeycomb.v3po/v3po2vpp

  1. private void updateInterface(final InstanceIdentifier<Interface> id,
  2. final Interface dataBefore,
  3. final Interface dataAfter, final WriteContext writeContext)
  4. throws VppBaseCallException, WriteTimeoutException {
  5. LOG.debug("Updating interface:{} to: {}", id, dataAfter);
  6. setInterfaceAttributes(id, dataAfter, dataAfter.getName(), writeContext);
  7. }

代码示例来源:origin: org.opendaylight.genius/interfacemanager-shell

  1. public static void showVxlanOutput(Interface iface, InterfaceInfo interfaceInfo) {
  2. StringBuilder sb = new StringBuilder();
  3. Formatter fmt = new Formatter(sb);
  4. System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT_LINE1,
  5. iface.getName(),
  6. iface.getDescription() == null ? UNSET : iface.getDescription()));
  7. sb.setLength(0);
  8. IfTunnel ifTunnel = iface.getAugmentation(IfTunnel.class);
  9. System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT,
  10. ifTunnel.getTunnelSource().getIpv4Address().getValue(),
  11. ifTunnel.getTunnelDestination().getIpv4Address().getValue(),
  12. ifTunnel.getTunnelGateway() == null ? UNSET : ifTunnel.getTunnelGateway().getIpv4Address().getValue(),
  13. (interfaceInfo == null) ? InterfaceInfo.InterfaceAdminState.DISABLED : interfaceInfo.getAdminState()));
  14. sb.setLength(0);
  15. ParentRefs parentRefs = iface.getAugmentation(ParentRefs.class);
  16. System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT + "\n",
  17. (interfaceInfo == null) ? InterfaceOpState.DOWN : interfaceInfo.getOpState(),
  18. String.format("%s/%s", parentRefs.getDatapathNodeIdentifier(),
  19. iface.getName()),
  20. (interfaceInfo == null) ? UNSET : interfaceInfo.getInterfaceTag(), ""));
  21. fmt.close();
  22. }
  23. }

代码示例来源:origin: org.opendaylight.groupbasedpolicy/vpp-renderer

  1. private static @Nullable String resolveBridgeDomain(@Nonnull Interface iface) {
  2. VppInterfaceAugmentation vppInterfaceAugmentation = iface.getAugmentation(VppInterfaceAugmentation.class);
  3. L2 existingL2 = vppInterfaceAugmentation.getL2();
  4. if (existingL2 != null) {
  5. Interconnection interconnection = existingL2.getInterconnection();
  6. if (interconnection instanceof BridgeBased) {
  7. return ((BridgeBased) interconnection).getBridgeDomain();
  8. }
  9. }
  10. return null;
  11. }

代码示例来源:origin: org.opendaylight.netvirt/vpnmanager-impl

  1. configInterface = InterfaceUtils.getInterface(dataBroker, interfaceName);
  2. if (configInterface != null) {
  3. if (!configInterface.getType().equals(Tunnel.class)) {
  4. LOG.debug("Config Interface Name {}", configInterface.getName());
  5. final VpnInterface vpnInterface = VpnUtil.getConfiguredVpnInterface(dataBroker, interfaceName);
  6. if (vpnInterface != null) {

代码示例来源:origin: org.opendaylight.vpnservice/vpnmanager-impl

  1. @Override
  2. protected void update(InstanceIdentifier<Interface> identifier,
  3. Interface original, Interface update) {
  4. LOG.trace("Operation Interface update event - Old: {}, New: {}", original, update);
  5. String interfaceName = update.getName();
  6. org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
  7. intf = InterfaceUtils.getInterface(broker, interfaceName);
  8. if (intf != null && intf.getType().equals(Tunnel.class)) {
  9. /*
  10. // FIXME: Blocked until tunnel event[vxlan/gre] support is available
  11. BigInteger dpnId = InterfaceUtils.getDpIdFromInterface(update);
  12. if(update.getOperStatus().equals(Interface.OperStatus.Up)) {
  13. //advertise all prefixes in all vpns for this dpn to bgp
  14. // vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.ADVERTISE_ROUTE);
  15. } else if(update.getOperStatus().equals(Interface.OperStatus.Down)) {
  16. //withdraw all prefixes in all vpns for this dpn from bgp
  17. // vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.WITHDRAW_ROUTE);
  18. }*/
  19. }
  20. }

相关文章