public static Node toADNode(final NodeId nodeId) throws ConstructionException { checkNotNull(nodeId); String nodeIdStripped = toADNodeId(nodeId); if (NUMBERS_ONLY.matcher(nodeIdStripped).matches()) { return new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeIdStripped)); } LOG.debug("NodeId does not match openflow id type, using " + NodeMapping.MD_SAL_TYPE + "instead"); NodeIDType.registerIDType(NodeMapping.MD_SAL_TYPE, String.class); return new Node(NodeMapping.MD_SAL_TYPE, nodeId.getValue()); } }
/** * Function called by the dependency manager when all the required * dependencies are satisfied * */ void init() { nodeProps = new ConcurrentHashMap<Node, Map<String, Property>>(); nodeConnectorProps = new ConcurrentHashMap<NodeConnector, Map<String, Property>>(); Node.NodeIDType.registerIDType("STUB", Integer.class); NodeConnector.NodeConnectorIDType.registerIDType("STUB", Integer.class, "STUB"); setupNodeProps(); setupNodeConnectorProps(); }
/** * Function called when the activator starts just after some initializations * are done by the ComponentActivatorAbstractBase. * */ public void init() { /* * KEYWD: ITRI_PEREGRINE_SNMP4SDN_Activator_RegisterNode&NodeConnectorOfTypeSNMP * OpenDaylight controller had defined several 'type', such as OF (i.e. OpenFlow) ONEPK etc. * If you'd like to add other custom types, it provides the 'registerIDType()' approach, as below, to manually add new type of Node and NodeConnector * Author: Yi-Ling Hsieh */ Node.NodeIDType.registerIDType("SNMP", Long.class); NodeConnector.NodeConnectorIDType.registerIDType("SNMP", Short.class, "SNMP"); //cancelled->TODO: Issue: is code architecture okay in this way?: the code above is moved to Controller.init(), because SNMP type is used during Topology Discovery but here Activator.init() is the latest code to be called in snmp4sdn start up (start up means all modules creation, initialization, start... and we also put Topology Discovery in InventoryServiceShim's start). }
/** * Function called when the activator starts just after some initializations * are done by the ComponentActivatorAbstractBase. * */ @Override public void init() { Node.NodeIDType.registerIDType("STUB", Integer.class); NodeConnector.NodeConnectorIDType.registerIDType("STUB", Integer.class, "STUB"); }
@Override protected void init() { // TODO: deprecated, should be removed soon NodeIDType.registerIDType(NodeMapping.MD_SAL_TYPE, String.class); NodeConnectorIDType.registerIDType(NodeMapping.MD_SAL_TYPE, String.class, NodeMapping.MD_SAL_TYPE); }
/** * Function called when the activator starts just after some initializations * are done by the ComponentActivatorAbstractBase. * Here it registers the node Type * */ @Override public void init() { Node.NodeIDType.registerIDType("OVS", String.class); }