- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
- createTapiNode(Map<NameKey, Name> nodeNames, Set<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(this.tapiLink.setTapiAdminState(this.ietfNodeAdminState.getName()))
- .setOperationalState(this.tapiLink.setTapiOperationalState(this.ietfNodeOperState.getName()))
- .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, TapiStringConstants.OTSI));
- // iNep creation on otsi node
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
- .toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
- Name onedName = new NameBuilder()
- .setValueName("iNodeEdgePoint")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI,
- 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, TapiStringConstants.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, TapiStringConstants.E_OTSI,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
- .toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
- Name onedName = new NameBuilder()
- .setValueName("eNodeEdgePoint")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI,
- 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, TapiStringConstants.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, TapiStringConstants.OTSI)))
- .setNodeEdgePointUuid(
- this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.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, TapiStringConstants.OTSI)))
- .setNodeEdgePointUuid(
- this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.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, TapiStringConstants.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, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()), nepUuid);
- NameBuilder nameBldr = new NameBuilder().setValue(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- 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,
- TapiStringConstants.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, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid);
- Name onedName = new NameBuilder()
- .setValueName("iNodeEdgePoint_N")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- 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,
- TapiStringConstants.I_ODU));
- 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, TapiStringConstants.DSR,
- tp.getValue())) || this.uuidMap.containsKey(String.join(
- "+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue()))) {
- String qual = tp.getValue().contains("CLIENT") ? TapiStringConstants.DSR
- : TapiStringConstants.I_ODU;
- 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,
- TapiStringConstants.DSR)))
- .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- qual, 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());
- AdministrativeState adminState = (oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() != null)
- ? this.tapiLink.setTapiAdminState(oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()
- .getName())
- : null;
- OperationalState operState = (oorTp.augmentation(TerminationPoint1.class).getOperationalState() != null)
- ? this.tapiLink.setTapiOperationalState(oorTp.augmentation(TerminationPoint1.class).getOperationalState()
- .getName())
- : null;
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(this.uuidMap.get(key))
- .setLayerProtocolName(nepProtocol)
- .setName(nepNames)
- .setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol))
- .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
- .setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(adminState)
- .setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED)
- .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- if (withSip) {
- onepBldr.setMappedServiceInterfacePoint(createSIP(1, oorTp, keyword));
- }
- return onepBldr.build();
- }
-