public static NodeConnector toADNodeConnector(final TpId source, final NodeId nodeId) throws ConstructionException { checkNotNull(source); String nodeConnectorIdStripped = toADNodeConnectorId(source); if (NUMBERS_ONLY.matcher(nodeConnectorIdStripped).matches()) { return new NodeConnector(NodeConnectorIDType.OPENFLOW, Short.valueOf(nodeConnectorIdStripped), toADNode(nodeId)); } LOG.debug("NodeConnectorId does not match openflow id type, using " + NodeMapping.MD_SAL_TYPE + "instead"); NodeConnectorIDType.registerIDType(NodeMapping.MD_SAL_TYPE, String.class, NodeMapping.MD_SAL_TYPE); return new NodeConnector(NodeMapping.MD_SAL_TYPE, nodeConnectorIdStripped, toADNode(nodeId)); }
/** * 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); }