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

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

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

Interface.getType介绍

[英]The type of the interface. When an interface entry is created, a server MAY initialize the type leaf with a valid value, e.g., if it is possible to derive the type from the name of the interface. If a client tries to set the type of an interface to a value that can never be used by the system, e.g., if the type is not supported or if the type does not match the name of the interface, the server MUST reject the request. A NETCONF server MUST reply with an rpc-error with the error-tag 'invalid-value' in this case.
[中]接口的类型。创建接口条目时,服务器可以使用有效值初始化类型叶,例如,如果可以从接口名称派生类型。如果客户端试图将接口的类型设置为系统永远无法使用的值,例如,如果不支持该类型或该类型与接口的名称不匹配,则服务器必须拒绝该请求。在这种情况下,NETCONF服务器必须使用带有错误标记“无效值”的rpc错误进行回复。

代码示例

代码示例来源: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.vpnservice/alivenessmonitor-impl

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

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

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

代码示例来源: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.mdsal.binding.model.ietf/rfc7223

return false;
if (!Objects.equals(_type, other.getType())) {
  return false;

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

return false;
if (!Objects.equals(_type, other.getType())) {
  return false;

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

@Override
protected void add(InstanceIdentifier<Interface> identifier, Interface intrf) {
  LOG.trace("SubnetRouteInterfaceListener add: Received interface {} up event", intrf);
  try {
    String interfaceName = intrf.getName();
    LOG.info("SubnetRouteInterfaceListener add: Received port UP event for interface {} ", interfaceName);
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
        configInterface = InterfaceUtils.getInterface(dataBroker, interfaceName);
    if (configInterface != null && (configInterface.getType() != null)) {
      if (!configInterface.getType().equals(Tunnel.class)) {
        final VpnInterface vpnInterface = VpnUtil.getConfiguredVpnInterface(dataBroker, interfaceName);
        if (vpnInterface != null) {
          BigInteger dpnId = BigInteger.ZERO;
          try {
            dpnId = InterfaceUtils.getDpIdFromInterface(intrf);
          } catch (Exception e) {
            LOG.error("SubnetRouteInterfaceListener add: Unable to obtain dpnId for interface {},",
                " subnetroute inclusion for this interface failed with exception {}",
                interfaceName, e);
            return;
          }
          vpnSubnetRouteHandler.onInterfaceUp(dpnId, intrf.getName());
        }
      }
    }
  } catch (Exception e) {
    LOG.error("SubnetRouteInterfaceListener add: Exception observed in handling addition for VPN Interface {}. ", intrf.getName(), e);
  }
}

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

@Override
protected void add(InstanceIdentifier<Interface> identifier, Interface intrf) {
 LOG.trace("Received interface {} up event", intrf);
 try {
  String interfaceName = intrf.getName();
  LOG.info("Received port UP event for interface {} ", interfaceName);
  org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface
    configInterface = InterfaceUtils.getInterface(broker, interfaceName);
  BigInteger dpnId = InterfaceUtils.getDpIdFromInterface(intrf);
  if (configInterface != null && configInterface.getType().equals(Tunnel.class)) {
   if(intrf.getOperStatus().equals(Interface.OperStatus.Up)) {
    //advertise all prefixes in all vpns for this dpn to bgp
    // FIXME: Blocked until tunnel event[vxlan/gre] support is available
    // vpnInterfaceManager.updatePrefixesForDPN(dpnId, VpnInterfaceManager.UpdateRouteAction.ADVERTISE_ROUTE);
   }
  } else {
   vpnInterfaceManager.processVpnInterfaceUp(dpnId, interfaceName, intrf.getIfIndex());
  }
 } catch (Exception e) {
  LOG.error("Exception caught in Interface Operational State Up event", e);
 }
}

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

public InterfaceBuilder(Interface base) {
  if (base.getKey() == null) {
    this._key = new InterfaceKey(
      base.getName()
    );
    this._name = base.getName();
  } else {
    this._key = base.getKey();
    this._name = _key.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")
    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;
    if (!casted.augmentations().isEmpty()) {
      this.augmentation = new HashMap<>(casted.augmentations());
    }
  }
}

代码示例来源: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.yangtools.model/ietf-interfaces

public InterfaceBuilder(Interface base) {
  if (base.getKey() == null) {
    this._key = new InterfaceKey(
      base.getName()
    );
    this._name = base.getName();
  } else {
    this._key = base.getKey();
    this._name = _key.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")
    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;
    if (!casted.augmentations().isEmpty()) {
      this.augmentation = new HashMap<>(casted.augmentations());
    }
  }
}

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

if (other.getType() != null) {
    return false;
} else if(!_type.equals(other.getType())) {
  return false;

代码示例来源: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());
  }
}

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

configInterface = InterfaceUtils.getInterface(dataBroker, interfaceName);
if (configInterface != null) {
  if (!configInterface.getType().equals(Tunnel.class)) {

相关文章