/** * Return the port identifier string in the given node connector ID. * * @param id A {@link NodeConnectorId} instance. * @return A port identifier string. * {@code null} is returned if the port identifier string is * not present. */ public static String getPortIdentifier(NodeConnectorId id) { return (id == null) ? null : id.getValue(); }
public static String getDpnFromNodeConnectorId(NodeConnectorId portId) { /* * NodeConnectorId is of form 'openflow:dpnid:portnum' */ String[] split = portId.getValue().split(OF_URI_SEPARATOR); return split[1]; }
/** * Match if port is equal. * @param port is the port filed in a flow entry. * @param matchFields are the target fields should be compared. * @return the result of match. */ public boolean matchInPort(NodeConnectorId port, MatchFields matchFields) { if (port == null) return true; String flowInPort = port.getValue(); return flowInPort.equals(matchFields.inPort); }
private String getDpnFromNodeConnectorId(NodeConnectorId portId) { String[] split = portId.getValue().split(OF_URI_SEPARATOR); return split[1]; }
public static String getDpnFromNodeConnectorId(NodeConnectorId portId) { /* * NodeConnectorId is of form 'openflow:dpnid:portnum' */ String[] split = portId.getValue().split(OF_URI_SEPARATOR); return split[1]; }
private static Integer returnOfPortFromNodeConnector(NodeConnectorId nodeConnectorId) { String[] elements = StringUtils.split(nodeConnectorId.getValue(), ":"); if (elements.length != 3) return null; return new Integer(elements[2]); }
/** * Parse an OF port number from a node connector ID * * @param id the ID * @return the port number */ public static long getOfPortNum(NodeConnectorId id) { String cnid = id.getValue(); int ci = cnid.lastIndexOf(':'); if (ci < 0 || (ci + 1 >= cnid.length())) throw new NumberFormatException("Invalid node connector ID " + cnid); return Long.parseLong(cnid.substring(ci + 1)); }
public static NodeId getNodeId(NodeConnectorId nodeConnectorId) { if (nodeConnectorId == null) return null; String[] tokens = nodeConnectorId.getValue().split(":"); if (tokens.length == 3) return new NodeId(OPENFLOW_NODE_PREFIX + Long.parseLong(tokens[1])); else return null; }
public static NodeId toAdNodeId(final NodeConnectorId nodeConnectorId) { NodeId nodeId = null; if (nodeConnectorId != null) { nodeId = new NodeId(COLON_NUMBERS_EOL.matcher(nodeConnectorId.getValue()).replaceFirst("")); } return nodeId; }
public boolean addDownPort (InstanceIdentifier<NodeConnector> port) { NodeConnectorId ncId = InstanceIdentifier.keyOf(port).getId(); if (ncId.getValue().contains("LOCAL")) { /* Ignoring port updates for LOCAL port connected to the controller */ LOG.debug ("getting a add port indication for LOCAL port. ignoring it"); return false; } this.downPortList.add(port); LOG.debug ("added port {} in downPortList", port); return true; } public void setFlowId (Long flowId)
/** * {@inheritDoc} */ @Override public void nodeConnectorRemoved(final InstanceIdentifier<NodeConnector> nodeConnectorInstanceId) { nodeConnectorMap.remove(nodeConnectorInstanceId); NodeConnectorId nodeConnectorId = InstanceIdentifier.keyOf(nodeConnectorInstanceId).getId(); LOG.trace("Port {} removed from LLDPSpeaker.nodeConnectorMap", nodeConnectorId.getValue()); }
@Override public void remove(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector del, InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) { if(compareInstanceIdentifierTail(identifier,II_TO_FLOW_CAPABLE_NODE_CONNECTOR)){ LOG.debug("Node Connector removed"); String sNodeConnectorIdentifier = nodeConnIdent .firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue(); BigInteger nDpId = getDpIdFromPortName(sNodeConnectorIdentifier); dpnToPortMultiMap.remove(nDpId, sNodeConnectorIdentifier); } }
public void setNodeConnectorConfig(InstanceIdentifier<NodeConnector> ncIid, FlowCapableNodeConnector fcnc) { if (fcnc == null) { fcncByNcIid.remove(ncIid); } else { fcncByNcIid.put(ncIid, fcnc); } LOG.trace("Switch {} node connector {} set {}", nodeId.getValue(), ncIid.firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue(), fcnc); update(); updateStatus(); }
public static MatchBuilder createInPortLocalMatch(MatchBuilder matchBuilder, Long dpidLong, String portId) { NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + portId); logger.debug("createInPortMatch() Node Connector ID is - Type=openflow: DPID={} inPort={} ", dpidLong, "LOCAL"); matchBuilder.setInPort(NodeConnectorId.getDefaultInstance(ncid.getValue())); matchBuilder.setInPort(ncid); return matchBuilder; }
private static TpId provideTopologyTerminationPointId(final InstanceIdentifier<FlowCapableNodeConnector> iiToNodeInInventory) { NodeConnectorKey inventoryNodeConnectorKey = iiToNodeInInventory.firstKeyOf(NodeConnector.class, NodeConnectorKey.class); if (inventoryNodeConnectorKey != null) { return new TpId(inventoryNodeConnectorKey.getId().getValue()); } return null; }
private void onDataDeleted(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) { Set<InstanceIdentifier<?>> removed = change.getRemovedPaths(); for (InstanceIdentifier<?> eachPath : removed) { if (eachPath.getTargetType() == FlowCapableNodeConnectorStatisticsData.class) { String name = eachPath.firstKeyOf(NodeConnector.class).getId().getValue(); nodeStatisticData.remove(name); } } } });
public static MatchBuilder createInPortReservedMatch(MatchBuilder matchBuilder, Long dpidLong, String inPort) { NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + inPort); LOG.debug("createInPortResrevedMatch() Node Connector ID is - Type=openflow: DPID={} inPort={} ", dpidLong, inPort); matchBuilder.setInPort(NodeConnectorId.getDefaultInstance(ncid.getValue())); matchBuilder.setInPort(ncid); return matchBuilder; }
public static org.opendaylight.controller.sal.core.NodeConnector toAdNodeConnector(final InstanceIdentifier<NodeConnector> identifier) { @SuppressWarnings("unchecked") final NodeConnectorKey tpKey = ((KeyedInstanceIdentifier<NodeConnector, NodeConnectorKey>) identifier).getKey(); return InventoryMapping.nodeConnectorFromId(tpKey.getId().getValue()); }
/** * {@inheritDoc} */ @Override public String getInputForLog() { InstanceIdentifier<?> path = getInput().getEgress().getValue(); NodeConnectorKey key = path.firstKeyOf(NodeConnector.class); return "{egress=" + key.getId().getValue() + "}"; } }
public static Action outputAction(NodeConnectorId id) { return new OutputActionCaseBuilder() .setOutputAction(new OutputActionBuilder() .setOutputNodeConnector(new Uri(id.getValue())) .build()) .build(); }