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

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

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

Interface.getAugmentation介绍

暂无

代码示例

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

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

代码示例来源: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.groupbasedpolicy/vpp-renderer

private static @Nullable String resolveBridgeDomain(@Nonnull Interface iface) {
  VppInterfaceAugmentation vppInterfaceAugmentation = iface.getAugmentation(VppInterfaceAugmentation.class);
  L2 existingL2 = vppInterfaceAugmentation.getL2();
  if (existingL2 != null) {
    Interconnection interconnection = existingL2.getInterconnection();
    if (interconnection instanceof BridgeBased) {
      return ((BridgeBased) interconnection).getBridgeDomain();
    }
  }
  return null;
}

代码示例来源: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.v3po/v3po2vpp

private static boolean isAssigned(@Nonnull final Acl acl,
                   @Nonnull final WriteContext writeContext) {
    final String aclName = acl.getAclName();
    final Class<? extends AclBase> aclType = acl.getAclType();
    final Interfaces interfaces = writeContext.readAfter(InstanceIdentifier.create(Interfaces.class)).get();

    return interfaces.getInterface().stream()
      .map(i -> Optional.ofNullable(i.getAugmentation(VppInterfaceAugmentation.class))
        .map(aug -> aug.getIetfAcl())
        .map(ietfAcl -> ietfAcl.getAccessLists())
        .map(accessLists -> accessLists.getAcl())
      )
      .flatMap(iacl -> iacl.isPresent()
        ? iacl.get().stream()
        : Stream.empty())
      .filter(assignedAcl -> aclName.equals(assignedAcl.getName()) && aclType.equals(assignedAcl.getType()))
      .findFirst().isPresent();
  }
}

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

if (!e.getValue().equals(other.getAugmentation(e.getKey()))) {
  return false;

代码示例来源: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 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.unimgr/unimgr-netvirt

List<String> trunks = ifaces.stream().filter(x -> x.getAugmentation(IfL2vlan.class) != null)//
    .filter(x -> x.getAugmentation(IfL2vlan.class).getL2vlanMode() == L2vlanMode.Trunk)//
    .map(x -> x.getName()).collect(Collectors.toList());
    .filter(x -> x.getAugmentation(IfL2vlan.class) != null)//
    .filter(x -> x.getAugmentation(IfL2vlan.class)//
            x -> x.getAugmentation(ParentRefs.class).getParentInterface(), //
                x -> x.getAugmentation(IfL2vlan.class).getVlanId().getValue(), //
                Collectors.toList())));

代码示例来源:origin: org.opendaylight.vpnservice/interfacemgr-api

public static short getVlanId(String interfaceName, DataBroker broker) {
  InstanceIdentifier<Interface> id = InstanceIdentifier.builder(Interfaces.class)
      .child(Interface.class, new InterfaceKey(interfaceName)).build();
  Optional<Interface> ifInstance = MDSALUtil.read(LogicalDatastoreType.CONFIGURATION, id, broker);
  if (ifInstance.isPresent()) {
    IfL2vlan vlanIface =ifInstance.get().getAugmentation(IfL2vlan.class);
    short vlanId = vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue().shortValue();
    return vlanId;
  }
  return -1;
}

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

public static short getVlanId(String interfaceName, DataBroker broker) {
  InstanceIdentifier<Interface> id = InstanceIdentifier.builder(Interfaces.class)
      .child(Interface.class, new InterfaceKey(interfaceName)).build();
  Optional<Interface> ifInstance = MDSALUtil.read(LogicalDatastoreType.CONFIGURATION, id, broker);
  if (ifInstance.isPresent()) {
    IfL2vlan vlanIface =ifInstance.get().getAugmentation(IfL2vlan.class);
    short vlanId = vlanIface.getVlanId() == null ? 0 : vlanIface.getVlanId().getValue().shortValue();
    return vlanId;
  }
  return -1;
}

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

/**
 * Gets the source dpn tep ip.
 *
 * @param srcDpnId
 *            the src dpn id
 * @param dstHwVtepNodeId
 *            the dst hw vtep node id
 * @return the dpn tep ip
 */
public IpAddress getSourceDpnTepIp(BigInteger srcDpnId, NodeId dstHwVtepNodeId) {
  IpAddress dpnTepIp = null;
  String tunnelInterfaceName = getExternalTunnelInterfaceName(String.valueOf(srcDpnId),
      dstHwVtepNodeId.getValue());
  if (tunnelInterfaceName != null) {
    Interface tunnelInterface = getInterfaceFromConfigDS(new InterfaceKey(tunnelInterfaceName), broker);
    if (tunnelInterface != null) {
      dpnTepIp = tunnelInterface.getAugmentation(IfTunnel.class).getTunnelSource();
    } else {
      LOG.warn("Tunnel interface not found for tunnelInterfaceName {}", tunnelInterfaceName);
    }
  } else {
    LOG.warn("Tunnel interface name not found for srcDpnId {} and dstHwVtepNodeId {}", srcDpnId,
        dstHwVtepNodeId);
  }
  return dpnTepIp;
}

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

public static void showVxlanOutput(Interface iface, InterfaceInfo interfaceInfo) {
    StringBuilder sb = new StringBuilder();
    Formatter fmt = new Formatter(sb);
    System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT_LINE1,
        iface.getName(),
        iface.getDescription() == null ? UNSET : iface.getDescription()));
    sb.setLength(0);
    IfTunnel ifTunnel = iface.getAugmentation(IfTunnel.class);
    System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT,
        ifTunnel.getTunnelSource().getIpv4Address().getValue(),
        ifTunnel.getTunnelDestination().getIpv4Address().getValue(),
        ifTunnel.getTunnelGateway() == null ? UNSET : ifTunnel.getTunnelGateway().getIpv4Address().getValue(),
        (interfaceInfo == null) ? InterfaceInfo.InterfaceAdminState.DISABLED : interfaceInfo.getAdminState()));
    sb.setLength(0);
    ParentRefs parentRefs = iface.getAugmentation(ParentRefs.class);
    System.out.println(fmt.format(VXLAN_OUTPUT_FORMAT + "\n",
        (interfaceInfo == null) ? InterfaceOpState.DOWN : interfaceInfo.getOpState(),
        String.format("%s/%s", parentRefs.getDatapathNodeIdentifier(),
            iface.getName()),
        (interfaceInfo == null) ? UNSET : interfaceInfo.getInterfaceTag(), ""));
    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.genius/itm-impl

Optional<Interface> ifaceObj = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, trunkIdentifier, dataBroker) ;
if (ifaceObj.isPresent()) {
  l2Vlan = (IfL2vlan) ifaceObj.get().getAugmentation(IfL2vlan.class);
  tunnelInterface = (IfTunnel) ifaceObj.get().getAugmentation(IfTunnel.class);

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

ParentRefs parent = inter.getAugmentation(ParentRefs.class);
if (parent == null || !physPortId.equals(parent.getParentInterface())) {
  continue;

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

@Override
protected void update(InstanceIdentifier<Interface> key, Interface portBefore, Interface portAfter) {
  InterfaceAcl aclInPortAfter = portAfter.getAugmentation(InterfaceAcl.class);
  InterfaceAcl aclInPortBefore = portBefore.getAugmentation(InterfaceAcl.class);
  if (aclInPortAfter != null && aclInPortAfter.isPortSecurityEnabled()
      || aclInPortBefore != null && aclInPortBefore.isPortSecurityEnabled()) {

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

if (updatedSecurityEnabled) {
  InterfaceAcl interfaceAcl = portInterface.getAugmentation(InterfaceAcl.class);
  interfaceAclBuilder = new InterfaceAclBuilder(interfaceAcl);
  interfaceAclBuilder.setSecurityGroups(

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

org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface iface =
        ItmUtils.getInterface(name, broker);
IfTunnel ifTunnel = iface.getAugmentation(IfTunnel.class);
ParentRefs parentRefs = iface.getAugmentation(ParentRefs.class);
if(ifTunnel == null && parentRefs == null) {
  return null;

相关文章