public static String getOvsdbPortName(OvsdbTerminationPointAugmentation ovsdbPort) { return ovsdbPort.getName(); }
/** * Construct a new instance. * * @param port The target neutron port. * @param ovtp The OVSDB termination point augmentation. */ private PortMapAttr(@Nonnull Port port, @Nonnull OvsdbTerminationPointAugmentation ovtp) { targetPort = port; portId = ovtp.getOfport(); portName = ovtp.getName(); }
public OvsdbTerminationPointAugmentation extractTerminationPointAugmentation(Node bridgeNode, String portName) { if (bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class) != null) { List<OvsdbTerminationPointAugmentation> tpAugmentations = extractTerminationPointAugmentations(bridgeNode); for (OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation : tpAugmentations) { if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { return ovsdbTerminationPointAugmentation; } } } return null; }
public OvsdbTerminationPointAugmentation extractTerminationPointAugmentation(Node bridgeNode, String portName) { if (bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class) != null) { List<OvsdbTerminationPointAugmentation> tpAugmentations = extractTerminationPointAugmentations(bridgeNode); for (OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation : tpAugmentations) { if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { return ovsdbTerminationPointAugmentation; } } } return null; }
public OvsdbTerminationPointAugmentation extractTerminationPointAugmentation(Node bridgeNode, String portName) { if (bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class) != null) { List<OvsdbTerminationPointAugmentation> tpAugmentations = extractTerminationPointAugmentations(bridgeNode); for (OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation : tpAugmentations) { if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { return ovsdbTerminationPointAugmentation; } } } return null; }
@Override public NeutronPort getTenantPort(OvsdbTerminationPointAugmentation terminationPointAugmentation) { Preconditions.checkNotNull(neutronPortCache); NeutronPort neutronPort = null; LOG.trace("getTenantPort for {}", terminationPointAugmentation.getName()); String neutronPortId = southbound.getInterfaceExternalIdsValue(terminationPointAugmentation, Constants.EXTERNAL_ID_INTERFACE_ID); if (neutronPortId != null) { neutronPort = neutronPortCache.getPort(neutronPortId); if (null == neutronPort) { LOG.debug("neutronPort is null checking the clean up cache."); neutronPort = neutronL3Adapter.getPortFromCleanupCache(neutronPortId); } } if (neutronPort != null) { LOG.debug("mapped to {}", neutronPort); } else { LOG.warn("getTenantPort did not find port for {}", terminationPointAugmentation.getName()); } return neutronPort; }
@Override public NeutronPort getTenantPort(OvsdbTerminationPointAugmentation terminationPointAugmentation) { Preconditions.checkNotNull(neutronPortCache); NeutronPort neutronPort = null; LOG.trace("getTenantPort for {}", terminationPointAugmentation.getName()); String neutronPortId = southbound.getInterfaceExternalIdsValue(terminationPointAugmentation, Constants.EXTERNAL_ID_INTERFACE_ID); if (neutronPortId != null) { neutronPort = neutronPortCache.getPort(neutronPortId); if (null == neutronPort) { LOG.debug("neutronPort is null checking the clean up cache."); neutronPort = neutronL3Adapter.getPortFromCleanupCache(neutronPortId); } } if (neutronPort != null) { LOG.debug("mapped to {}", neutronPort); } else { LOG.warn("getTenantPort did not find port for {}", terminationPointAugmentation.getName()); } return neutronPort; }
public OvsdbTerminationPointAugmentation getTerminationPointOfBridge(Node node, String portName) { OvsdbTerminationPointAugmentation tpAugmentation = extractTerminationPointAugmentation(node,portName); if(tpAugmentation == null){ List<OvsdbTerminationPointAugmentation> tpAugmentations = readTerminationPointAugmentations(node); if(tpAugmentations != null){ for(OvsdbTerminationPointAugmentation ovsdbTpAugmentation : tpAugmentations){ if(ovsdbTpAugmentation.getName().equals(portName)){ return ovsdbTpAugmentation; } } } } return tpAugmentation; }
public OvsdbTerminationPointAugmentation getTerminationPointOfBridge(Node node, String portName) { OvsdbTerminationPointAugmentation tpAugmentation = extractTerminationPointAugmentation(node,portName); if(tpAugmentation == null){ List<OvsdbTerminationPointAugmentation> tpAugmentations = readTerminationPointAugmentations(node); if(tpAugmentations != null){ for(OvsdbTerminationPointAugmentation ovsdbTpAugmentation : tpAugmentations){ if(ovsdbTpAugmentation.getName().equals(portName)){ return ovsdbTpAugmentation; } } } } return tpAugmentation; }
@Override public boolean isLastPortinBridge(Node node, OvsdbTerminationPointAugmentation terminationPointAugmentation) { LOG.trace("isLastPortinBridge: for {}", terminationPointAugmentation.getName()); List<TerminationPoint> terminationPoints = node.getTerminationPoint(); /*Check whether the node has any port other than br-int*/ if (terminationPoints != null && !terminationPoints.isEmpty()) { for (TerminationPoint tp : terminationPoints) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (null != ovsdbTerminationPointAugmentation && !(ovsdbTerminationPointAugmentation.getName().equals(Constants.INTEGRATION_BRIDGE)) && !(terminationPointAugmentation.getInterfaceUuid() .equals(ovsdbTerminationPointAugmentation.getInterfaceUuid()))) { LOG.debug("isLastPortinBridge: it the last port in bridge {}", terminationPointAugmentation.getName()); return false; } } } return true; }
@Override public boolean isLastPortinBridge(Node node, OvsdbTerminationPointAugmentation terminationPointAugmentation) { LOG.trace("isLastPortinBridge: for {}", terminationPointAugmentation.getName()); List<TerminationPoint> terminationPoints = node.getTerminationPoint(); /*Check whether the node has any port other than br-int*/ if (terminationPoints != null && !terminationPoints.isEmpty()) { for (TerminationPoint tp : terminationPoints) { OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class); if (null != ovsdbTerminationPointAugmentation && !(ovsdbTerminationPointAugmentation.getName().equals(Constants.INTEGRATION_BRIDGE)) && !(terminationPointAugmentation.getInterfaceUuid() .equals(ovsdbTerminationPointAugmentation.getInterfaceUuid()))) { LOG.debug("isLastPortinBridge: it the last port in bridge {}", terminationPointAugmentation.getName()); return false; } } } return true; }
/** * Return the particular port detail of the given Node. * * @param bridgeNode A {@link Node} instance. * @param portName The name of the port. * @return OvsdbTerminationPointAugmentation. */ private OvsdbTerminationPointAugmentation extractTerminationPointAugmentation(Node bridgeNode, String portName) { if (bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class) != null) { List<OvsdbTerminationPointAugmentation> tpAugmentations = extractTerminationPointAugmentations(bridgeNode); for (OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation : tpAugmentations) { if (ovsdbTerminationPointAugmentation.getName().equals(portName)) { return ovsdbTerminationPointAugmentation; } } } return null; }
/** * Extract the <code>OvsdbTerminationPointAugmentation</code> for the particular <code>node</code> identified by * <code>portName</code>. * * @param node * @param portName * @return */ public OvsdbTerminationPointAugmentation getTerminationPointOfBridge(Node node, String portName) { OvsdbTerminationPointAugmentation tpAugmentation = extractTerminationPointAugmentation(node,portName); if(tpAugmentation == null){ List<OvsdbTerminationPointAugmentation> tpAugmentations = readTerminationPointAugmentations(node); if(tpAugmentations != null){ for(OvsdbTerminationPointAugmentation ovsdbTpAugmentation : tpAugmentations){ if(ovsdbTpAugmentation.getName().equals(portName)){ return ovsdbTpAugmentation; } } } } return tpAugmentation; }
private boolean isInterfaceOfInterest(OvsdbTerminationPointAugmentation terminationPoint, List<String> phyIfName) { LOG.trace("SouthboundHandler#isInterfaceOfInterest: Interface : {}", terminationPoint); if(terminationPoint.getInterfaceType() == null){ // This is OK since eth ports don't have an interface type LOG.info("No type found for the interface : {}", terminationPoint); return false; } return MdsalHelper.createOvsdbInterfaceType( terminationPoint.getInterfaceType()).equals(NetworkHandler.NETWORK_TYPE_VXLAN) || MdsalHelper.createOvsdbInterfaceType( terminationPoint.getInterfaceType()).equals(NetworkHandler.NETWORK_TYPE_GRE) || phyIfName.contains(terminationPoint.getName()); }
private boolean isInterfaceOfInterest(OvsdbTerminationPointAugmentation terminationPoint, List<String> phyIfName) { LOG.trace("SouthboundHandler#isInterfaceOfInterest: Interface : {}", terminationPoint); if(terminationPoint.getInterfaceType() == null){ // This is OK since eth ports don't have an interface type return false; } return MdsalHelper.createOvsdbInterfaceType( terminationPoint.getInterfaceType()).equals(NetworkHandler.NETWORK_TYPE_VXLAN) || MdsalHelper.createOvsdbInterfaceType( terminationPoint.getInterfaceType()).equals(NetworkHandler.NETWORK_TYPE_GRE) || phyIfName.contains(terminationPoint.getName()); }
private void doNeutronPortDeleted(NeutronPort neutronPort) { LOG.debug("Handling neutron delete port {}", neutronPort); distributedArpService.handlePortEvent(neutronPort, Action.DELETE); neutronL3Adapter.handleNeutronPortEvent(neutronPort, Action.DELETE); //TODO: Need to implement getNodes List<Node> nodes = nodeCacheManager.getNodes(); for (Node node : nodes) { OvsdbTerminationPointAugmentation port = findPortOnNode(node, neutronPort); if (port != null) { LOG.trace("neutronPortDeleted: Delete interface {}", port.getName()); southbound.deleteTerminationPoint(node, port.getName()); break; } } LOG.debug(" PORT delete successful for tenant-id - {}, network-id - {}, port-id - {}", neutronPort.getTenantID(), neutronPort.getNetworkUUID(), neutronPort.getID()); }
/** * Process the event. * * @param bridgeNode An instance of Node object. * @param intf An {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105 * .OvsdbTerminationPointAugmentation} instance of OvsdbTerminationPointAugmentation object. * @param neutronNetwork An {@link NeutronNetwork} instance of NeutronNetwork * object. * @param action the {@link Action} action to be handled. */ public void processInterfaceEvent(final Node bridgeNode, final OvsdbTerminationPointAugmentation intf, final NeutronNetwork neutronNetwork, Action action) { LOG.debug("southbound interface {} node:{} interface:{}, neutronNetwork:{}", action, bridgeNode.getNodeId().getValue(), intf.getName(), neutronNetwork); final NeutronPort neutronPort = tenantNetworkManager.getTenantPort(intf); if (neutronPort != null) { this.handlePortEvent(neutronPort, action); } }
/** * Process the event. * * @param bridgeNode An instance of Node object. * @param intf An {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105 * .OvsdbTerminationPointAugmentation} instance of OvsdbTerminationPointAugmentation object. * @param neutronNetwork An {@link org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork} instance of NeutronNetwork * object. * @param action the {@link org.opendaylight.ovsdb.openstack.netvirt.api.Action} action to be handled. */ public void processInterfaceEvent(final Node bridgeNode, final OvsdbTerminationPointAugmentation intf, final NeutronNetwork neutronNetwork, Action action) { LOG.debug("southbound interface {} node:{} interface:{}, neutronNetwork:{}", action, bridgeNode.getNodeId().getValue(), intf.getName(), neutronNetwork); final NeutronPort neutronPort = tenantNetworkManager.getTenantPort(intf); if (neutronPort != null) { this.handlePortEvent(neutronPort, action); } }
private void createPort( final OvsdbTerminationPointAugmentation terminationPoint, final Port port, final String interfaceUuid) { port.setName(terminationPoint.getName()); port.setInterfaces(Sets.newHashSet(new UUID(interfaceUuid))); createPortOtherConfig(terminationPoint, port); createPortVlanTag(terminationPoint, port); createPortVlanTrunk(terminationPoint, port); createPortVlanMode(terminationPoint, port); createPortExternalIds(terminationPoint, port); }
private void createInterface( final OvsdbTerminationPointAugmentation terminationPoint, final Interface ovsInterface) { ovsInterface.setName(terminationPoint.getName()); createInterfaceType(terminationPoint, ovsInterface); createOfPort(terminationPoint, ovsInterface); createOfPortRequest(terminationPoint, ovsInterface); createInterfaceOptions(terminationPoint, ovsInterface); createInterfaceOtherConfig(terminationPoint, ovsInterface); createInterfaceExternalIds(terminationPoint, ovsInterface); createInterfaceLldp(terminationPoint, ovsInterface); createInterfaceBfd(terminationPoint, ovsInterface); }