/** * 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(); }
/** * Constructor for the Node objects, it validate the input so if * the ID passed is not of the type expected accordingly to the * type an exception is raised. * * @param nodeType Type of the node we are building * @param id ID used by the SDN technology to identify the node * */ public Node(String nodeType, Object id) throws ConstructionException { if (NodeIDType.getClassType(nodeType) != null && NodeIDType.getClassType(nodeType).isInstance(id)) { this.nodeType = nodeType; this.nodeID = id; } else { throw new ConstructionException("Type of incoming object:" + id.getClass() + " not compatible with expected type:" + NodeIDType.getClassType(nodeType)); } }
/** * Function called when the activator stops just before the cleanup done by * ComponentActivatorAbstractBase * */ public void destroy() { /* * 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 shown in the init() above, to manually add new type of Node and NodeConnector To un-register the 'type', you can use 'unRegisterIDType()' as below. * Author: Yi-Ling Hsieh */ Node.NodeIDType.unRegisterIDType("SNMP"); NodeConnector.NodeConnectorIDType.unRegisterIDType("SNMP"); config.close();//md-sal fdb.close();//md-sal acl.close();//md-sal vlan.close();//md-sal switchdb.close();//md-sal topo.close();//md-sal }
/** * 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 stops just before the cleanup done by * ComponentActivatorAbstractBase * */ @Override public void destroy() { Node.NodeIDType.unRegisterIDType("OVS"); } @Override
/** * 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); }
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 when the activator stops just before the cleanup done by * ComponentActivatorAbstractBase * */ @Override public void destroy() { Node.NodeIDType.unRegisterIDType("STUB"); NodeConnector.NodeConnectorIDType.unRegisterIDType("STUB"); }
/** * 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); }