- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
- createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
- Uuid nodeUuid = null;
- Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
- Map<RuleKey, Rule> ruleList = new HashMap<>();
- Rule rule = new RuleBuilder()
- .setLocalId("forward")
- .setForwardingRule(ForwardingRule.MAYFORWARDACROSSGROUP)
- .setRuleType(RuleType.FORWARDING)
- .build();
- ruleList.put(rule.key(), rule);
- if (layerProtocols.contains(LayerProtocolName.DSR)) {
- nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, ruleList);
- } else if (layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
- nodeUuid = getNodeUuid4Photonic(onepl, nodeRuleGroupList, ruleList);
- } else {
- LOG.error("Undefined LayerProtocolName for {} node {}", nodeNames.get(nodeNames.keySet().iterator().next())
- .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
- }
- return new NodeBuilder()
- .setUuid(nodeUuid)
- .setName(nodeNames)
- .setLayerProtocolName(layerProtocols)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
- .setLifecycleState(LifecycleState.INSTALLED)
- .setOwnedNodeEdgePoint(onepl)
- .setNodeRuleGroup(nodeRuleGroupList)
- .build();
- }
-
- private Uuid getNodeUuid4Photonic(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
- Uuid nodeUuid;
- nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI));
- // iNep creation on otsi node
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()),
- nepUuid1);
- Name onedName = new NameBuilder()
- .setValueName("iNodeEdgePoint")
- .setValue(oorNetworkPortList.get(i).getTpId().getValue())
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
- String.join("+", this.ietfNodeId, I_OTSI));
- onepl.put(onep.key(), onep);
- }
- // eNep creation on otsi node
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()),
- nepUuid2);
- Name onedName = new NameBuilder()
- .setValueName("eNodeEdgePoint")
- .setValue(oorNetworkPortList.get(i).getTpId().getValue())
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
- String.join("+", this.ietfNodeId, E_OTSI));
- onepl.put(onep.key(), onep);
- }
- // create NodeRuleGroup
- int count = 1;
- for (TerminationPoint tp : this.oorNetworkPortList) {
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
- nepList = new HashMap<>();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
- .NodeEdgePoint inep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
- .node.rule.group.NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
- .setNodeEdgePointUuid(
- this.uuidMap.get(String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue())))
- .build();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
- .NodeEdgePoint enep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
- .node.rule.group.NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
- .setNodeEdgePointUuid(
- this.uuidMap.get(String.join("+", this.ietfNodeId, E_OTSI, tp.getTpId().getValue())))
- .build();
- nepList.put(inep.key(), inep);
- nepList.put(enep.key(), enep);
- NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(
- UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8")))
- .toString()))
- .setRule(ruleList)
- .setNodeEdgePoint(nepList)
- .build();
- nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
- count++;
- }
- return nodeUuid;
- }
-
- private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
- Uuid nodeUuid;
- nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, DSR));
- // client nep creation on DSR/ODU node
- for (int i = 0; i < oorClientPortList.size(); i++) {
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()),
- nepUuid);
- NameBuilder nameBldr = new NameBuilder().setValue(oorClientPortList.get(i).getTpId().getValue());
- Name name;
- if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
- name = nameBldr.setValueName("100G-tpdr").build();
- } else {
- name = nameBldr.setValueName("NodeEdgePoint_C").build();
- }
-
- OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
- LayerProtocolName.ETH, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR));
- onepl.put(onep.key(), onep);
- }
- // network nep creation on DSR/ODU node
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()),
- nepUuid);
- Name onedName = new NameBuilder()
- .setValueName("NodeEdgePoint_N")
- .setValue(oorNetworkPortList.get(i).getTpId().getValue())
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR));
- onepl.put(onep.key(), onep);
- }
- // create NodeRuleGroup
- int count = 1;
- for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) {
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
- nepList = new HashMap<>();
- for (TpId tp : nbl.getTpList()) {
- if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, DSR, tp.getValue()))) {
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint
- nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
- .NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
- .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR, tp.getValue())))
- .build();
- nepList.put(nep.key(), nep);
- }
- }
- NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(
- UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8")))
- .toString()))
- .setRule(ruleList)
- .setNodeEdgePoint(nepList)
- .build();
- nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
- count++;
- }
- return nodeUuid;
- }
-
- private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
- LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
- String key = String.join("+", keyword, oorTp.getTpId().getValue());
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(this.uuidMap.get(key))
- .setLayerProtocolName(nepProtocol)
- .setName(nepNames);
- if (withSip) {
- onepBldr.setMappedServiceInterfacePoint(createSIP(this.uuidMap.get(key), 1));
- }
- onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol));
- onepBldr.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
- .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- return onepBldr.build();
- }
-