org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.getName()方法的使用及代码示例

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

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

Interface.getName介绍

[英]The name of the interface. A device MAY restrict the allowed values for this leaf, possibly depending on the type of the interface. For system-controlled interfaces, this leaf is the device-specific name of the interface. The 'config false' list /interfaces-state/interface contains the currently existing interfaces on the device. If a client tries to create configuration for a system-controlled interface that is not present in the /interfaces-state/interface list, the server MAY reject the request if the implementation does not support pre-provisioning of interfaces or if the name refers to an interface that can never exist in the system. A NETCONF server MUST reply with an rpc-error with the error-tag 'invalid-value' in this case. If the device supports pre-provisioning of interface configuration, the 'pre-provisioning' feature is advertised. If the device allows arbitrarily named user-controlled interfaces, the 'arbitrary-names' feature is advertised. When a configured user-controlled interface is created by the system, it is instantiated with the same name in the /interface-state/interface list.
[中]

代码示例

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

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

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

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

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

private void setInterface(final InstanceIdentifier<Interface> id, final Interface swIf,
             final WriteContext writeContext) throws WriteFailedException {
  LOG.debug("Setting interface: {} to: {}", id, swIf);
  setInterfaceAttributes(id, swIf, swIf.getName(), writeContext);
}

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

private void setInterface(final InstanceIdentifier<Interface> id, final Interface swIf,
             final WriteContext writeContext)
  throws VppBaseCallException, WriteTimeoutException {
  LOG.debug("Setting interface: {} to: {}", id, swIf);
  setInterfaceAttributes(id, swIf, swIf.getName(), writeContext);
}

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

@Override
public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Interface> id,
                  @Nonnull final Interface dataBefore,
                  @Nonnull final WriteContext writeContext)
  throws WriteFailedException.DeleteFailedException {
  // Special handling for local0 interface (HC2VPP-308):
  if (LOCAL0_NAME.equals(dataBefore.getName())) {
    throw new WriteFailedException.DeleteFailedException(id,
      new UnsupportedOperationException("Removing " + LOCAL0_NAME + " interface is not supported"));
  }
  // For other interfaces, delegate delete  to customizers for specific interface types (e.g. VXLan, Tap).
}

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

private void updateInterface(final InstanceIdentifier<Interface> id,
               final Interface dataAfter, final WriteContext writeContext)
    throws WriteFailedException {
  LOG.debug("Updating interface:{} to: {}", id, dataAfter);
  setInterfaceAttributes(id, dataAfter, dataAfter.getName(), writeContext);
}

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

@Override
protected void remove(InstanceIdentifier<Interface> key, Interface port) {
  AclInterfaceCacheUtil.removeAclInterfaceFromCache(port.getName());
}

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

public static List<AllowedAddressPairs> getPortAllowedAddresses(Interface port) {
  if (port == null) {
    LOG.error("Port is Null");
    return null;
  }
  InterfaceAcl aclInPort = port.getAugmentation(InterfaceAcl.class);
  if (aclInPort == null) {
    LOG.error("getSecurityGroupInPortList: no security group associated to Interface port: {}", port.getName());
    return null;
  }
  return aclInPort.getAllowedAddressPairs();
}

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

private static void write(Interface iface, WriteTransaction tx) {
  String interfaceName = iface.getName();
  InstanceIdentifier<Interface> interfaceIdentifier = createInterfaceIdentifier(interfaceName);
  tx.put(LogicalDatastoreType.CONFIGURATION, interfaceIdentifier, iface, true);
}

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

/**
 * Checks whether port security is enabled for the port.
 * @param port the port.
 * @return the list of security groups.
 */
public static List<Uuid> getInterfaceAcls(Interface port) {
  if (port == null) {
    LOG.error("Port is Null");
    return null;
  }
  InterfaceAcl aclInPort = port.getAugmentation(InterfaceAcl.class);
  if (aclInPort == null) {
    LOG.error("getSecurityGroupInPortList: no security group associated}",
      port.getName());
    return null;
  }
  return aclInPort.getSecurityGroups();
}

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

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

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

private String createOfPortInterface(Port port) {
  Interface inf = createInterface(port);
  String infName = inf.getName();
  LOG.debug("Creating OFPort Interface {}", infName);
  InstanceIdentifier interfaceIdentifier = NeutronvpnUtils.buildVlanInterfaceIdentifier(infName);
  try {
    Optional<Interface> optionalInf = NeutronvpnUtils.read(dataBroker, LogicalDatastoreType.CONFIGURATION,
        interfaceIdentifier);
    if (!optionalInf.isPresent()) {
      MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, interfaceIdentifier, inf);
    } else {
      LOG.error("Interface {} is already present", infName);
    }
  } catch (Exception e) {
    LOG.error("failed to create interface {} due to the exception {} ", infName, e.getMessage());
  }
  return infName;
}

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

private String updateOfPortInterface(Port original, Port updated) {
  Interface inf = updateInterface(original, updated);
  String infName = inf.getName();
  LOG.debug("Updating OFPort Interface {}", infName);
  InstanceIdentifier interfaceIdentifier = NeutronvpnUtils.buildVlanInterfaceIdentifier(infName);
  try {
    Optional<Interface> optionalInf = NeutronvpnUtils.read(dataBroker, LogicalDatastoreType.CONFIGURATION,
        interfaceIdentifier);
    if (optionalInf.isPresent()) {
      MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, interfaceIdentifier, inf);
    } else {
      LOG.error("Interface {} doesn't exist", infName);
    }
  } catch (Exception e) {
    LOG.error("failed to update interface {} due to the exception {} ", infName, e.getMessage());
  }
  return infName;
}

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

@Override
  protected Object doExecute() throws Exception {
    logger.debug("Executing show Vxlan command");
    List<Interface> vxlanList = interfaceManager.getVxlanInterfaces();
    if (!vxlanList.isEmpty()) {
      IfmCLIUtil.showVxlanHeaderOutput();
    }
    for (Interface iface : vxlanList) {
      InterfaceInfo ifaceState = interfaceManager.getInterfaceInfoFromOperationalDataStore(iface.getName());
      IfmCLIUtil.showVxlanOutput(iface, ifaceState);
    }
    return null;
  }
}

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

public InterfaceBuilder(Interface base) {
  this.key = base.key();
  this._name = base.getName();
  this._description = base.getDescription();
  this._linkUpDownTrapEnable = base.getLinkUpDownTrapEnable();
  this._type = base.getType();
  this._enabled = base.isEnabled();
  if (base instanceof InterfaceImpl) {
    InterfaceImpl impl = (InterfaceImpl) base;
    if (!impl.augmentation.isEmpty()) {
      this.augmentation = new HashMap<>(impl.augmentation);
    }
  } else if (base instanceof AugmentationHolder) {
    @SuppressWarnings("unchecked")
    Map<Class<? extends Augmentation<Interface>>, Augmentation<Interface>> aug =((AugmentationHolder<Interface>) base).augmentations();
    if (!aug.isEmpty()) {
      this.augmentation = new HashMap<>(aug);
    }
  }
}

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

@Override
  protected Object doExecute() throws Exception {
    logger.debug("Executing show VLAN command");
    List<Interface> vlanList = interfaceManager.getVlanInterfaces();
    if (!vlanList.isEmpty()) {
      IfmCLIUtil.showVlanHeaderOutput();
    }
    for (Interface iface : vlanList) {
      InterfaceInfo ifaceState = interfaceManager.getInterfaceInfoFromOperationalDataStore(iface.getName());
      IfmCLIUtil.showVlanOutput(ifaceState, iface);
    }
    return null;
  }
}

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

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

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

public static void showVlanOutput(InterfaceInfo ifaceInfo, Interface iface) {
  StringBuilder sb = new StringBuilder();
  Formatter fmt = new Formatter(sb);
  IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
  int vlanId = l2vlan != null ? l2vlan.getVlanId() != null ? l2vlan.getVlanId().getValue() : 0 : 0;
  System.out.println(fmt.format(VLAN_OUTPUT_FORMAT_LINE1,
      iface.getName()));
  sb.setLength(0);
  System.out.println(fmt.format(VLAN_OUTPUT_FORMAT,
      "", (ifaceInfo == null) ? UNSET : ifaceInfo.getDpId(),
      (ifaceInfo == null) ? UNSET : ifaceInfo.getPortName(), vlanId));
  sb.setLength(0);
  System.out.println(fmt.format(VLAN_OUTPUT_FORMAT,
      (ifaceInfo == null) ? UNSET : ifaceInfo.getInterfaceTag(),
      (ifaceInfo == null) ? UNSET  : ifaceInfo.getPortNo(),
      (ifaceInfo == null) ? UNSET : ifaceInfo.getAdminState(),
      (ifaceInfo == null) ? UNSET : ifaceInfo.getOpState()));
  sb.setLength(0);
  System.out.println(fmt.format(VLAN_OUTPUT_FORMAT + "\n",
      iface.getDescription(), "", "", ""));
  sb.setLength(0);
  fmt.close();
}

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

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

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

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

相关文章