- assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
- nrgList.get(1).getNodeEdgePoint().get(0).getNodeEdgePointUuid().getValue(),
- either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
- assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
- nrgList.get(1).getNodeEdgePoint().get(1).getNodeEdgePointUuid().getValue(),
- either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
- assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
- nrgList.get(1).getNodeEdgePoint().get(0).getNodeUuid(), nodeUuid);
- assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
- nrgList.get(1).getNodeEdgePoint().get(1).getNodeUuid(), nodeUuid);
- assertEquals("node-rule-group nb 2 should contain a single rule", 1, nrgList.get(1).getRule().size());
- assertEquals("local-id of the rule should be 'forward'",
- "forward", nrgList.get(1).getRule().get(0).getLocalId());
- assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
- ForwardingRule.MAYFORWARDACROSSGROUP, nrgList.get(1).getRule().get(0).getForwardingRule());
- assertEquals("the rule type should be 'FORWARDING'",
- RuleType.FORWARDING, nrgList.get(1).getRule().get(0).getRuleType());
- }
-
- private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
- Uuid nodeUuid) {
- assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
- assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
- List<NodeEdgePoint> nrg = nrgList.get(0).getNodeEdgePoint().values().stream()
- .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
- .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
- .collect(Collectors.toList());
- assertEquals("in the sorted node-rule-group, nep number 2 should be XPDR2-NETWORK1",
- networkNepUuid, nrg.get(1).getNodeEdgePointUuid());
- assertEquals("in the sorted node-rule-group, nep number 6 should be XPDR2-CLIENT4",
- clientNepUuid, nrg.get(5).getNodeEdgePointUuid());
- assertEquals("any item of the node-rule-group should have the same nodeUuid",
- nodeUuid, nrg.get(1).getNodeUuid());
- assertEquals("any item of the node-rule-group should have the same nodeUuid",
- nodeUuid, nrg.get(5).getNodeUuid());
- assertEquals("node-rule-group should contain a single rule", 1, nrgList.get(0).getRule().size());
- assertEquals("local-id of the rule should be 'forward'",
- "forward", nrgList.get(0).getRule().get(0).getLocalId());
- assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
- ForwardingRule.MAYFORWARDACROSSGROUP, nrgList.get(0).getRule().get(0).getForwardingRule());
- assertEquals("the rule type should be 'FORWARDING'",
- RuleType.FORWARDING, nrgList.get(0).getRule().get(0).getRuleType());
- }
-
- private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
- Uuid nodeUuid) {
- assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
- assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nrgList.get(0).getNodeEdgePoint().size());
- assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
- nrgList.get(0).getNodeEdgePoint().get(0).getNodeEdgePointUuid().getValue(),
- either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
- assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
- nrgList.get(0).getNodeEdgePoint().get(1).getNodeEdgePointUuid().getValue(),
- either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
- assertEquals("any item of the node-rule-group should have the same nodeUuid",
- nodeUuid, nrgList.get(0).getNodeEdgePoint().get(0).getNodeUuid());
- assertEquals("any item of the node-rule-group should have the same nodeUuid",
- nodeUuid, nrgList.get(0).getNodeEdgePoint().get(1).getNodeUuid());
- assertEquals("node-rule-group should contain a single rule", 1, nrgList.get(0).getRule().size());
- assertEquals("local-id of the rule should be 'forward'",
- "forward", nrgList.get(0).getRule().get(0).getLocalId());
- assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
- ForwardingRule.MAYFORWARDACROSSGROUP, nrgList.get(0).getRule().get(0).getForwardingRule());
- assertEquals("the rule type should be 'FORWARDING'",
- RuleType.FORWARDING, nrgList.get(0).getRule().get(0).getRuleType());
- }
-
- private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
- Uuid nodeUuid) {
- assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
- for (NodeRuleGroup nodeRuleGroup : nrgList) {
- assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
- 2, nodeRuleGroup.getNodeEdgePoint().size());
- }
- assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
- nrgList.get(1).getNodeEdgePoint().get(0).getNodeEdgePointUuid().getValue(),
- either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
- assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
- nrgList.get(1).getNodeEdgePoint().get(1).getNodeEdgePointUuid().getValue(),
- either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
- assertEquals("any item of the node-rule-group should have the same nodeUuid",
- nodeUuid, nrgList.get(0).getNodeEdgePoint().get(0).getNodeUuid());
- assertEquals("any item of the node-rule-group should have the same nodeUuid",
- nodeUuid, nrgList.get(0).getNodeEdgePoint().get(1).getNodeUuid());
- assertEquals("node-rule-group should contain a single rule", 1, nrgList.get(0).getRule().size());
- assertEquals("local-id of the rule should be 'forward'",
- "forward", nrgList.get(0).getRule().get(0).getLocalId());
- assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
- ForwardingRule.MAYFORWARDACROSSGROUP, nrgList.get(0).getRule().get(0).getForwardingRule());
- assertEquals("the rule type should be 'FORWARDING'",
- RuleType.FORWARDING, nrgList.get(0).getRule().get(0).getRuleType());
- }
-
- private void checkNepClient100G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
- assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
- assertEquals("value of client nep should be '" + portName + "'",
- portName, nep.getName().get(0).getValue());
- assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
- nepName, nep.getName().get(0).getValueName());
- assertEquals("Client nep should support 2 kind of cep",
- 2, nep.getSupportedCepLayerProtocolQualifier().size());
- assertThat("client nep should support 2 kind of cep",
- nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
- assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
- checkCommonPartOfNep(nep);
- }
-
- private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
- assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
- assertEquals("value of OTSi nep should be '" + portName + "'",
- portName, nep.getName().get(0).getValue());
- assertEquals("value-name of OTSi nep should be '" + nepName + "'",
- nepName, nep.getName().get(0).getValueName());
- assertEquals("OTSi nep should support 2 kind of cep",
- 2, nep.getSupportedCepLayerProtocolQualifier().size());
- assertThat("OTSi nep should support 2 kind of cep",
- nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
- assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
- LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
- assertEquals("OTSi nep should support one SIP", 1, nep.getMappedServiceInterfacePoint().size());
- checkCommonPartOfNep(nep);
- }
-
- private void checkCommonPartOfNep(OwnedNodeEdgePoint nep) {
- assertEquals("link port direction should be DIRECTIONAL",
- PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
- assertEquals("administrative state should be UNLOCKED",
- AdministrativeState.UNLOCKED, nep.getAdministrativeState());
- assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
- TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
- assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
- assertEquals("client nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
- assertEquals("termination direction should be BIDIRECTIONAL",
- TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
- assertEquals("operational state of client nep should be ENABLED",
- OperationalState.ENABLED, nep.getOperationalState());
- assertEquals("link-port-role of client nep should be SYMMETRIC",
- PortRole.SYMMETRIC, nep.getLinkPortRole());
- }
-
- private void checkTransitionalLink(Link link, Uuid topoUuid, Uuid node1Uuid, Uuid node2Uuid, String tp1,
- String tp2) {
- Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "--" + tp2).getBytes(Charset.forName("UTF-8")))
- .toString());
- assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
- assertEquals("Available capacity unit should be GBPS",
- CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
- assertEquals("Available capacity -total size value should be 100",
- Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
- assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
- 2, link.getTransitionedLayerProtocolName().size());
- assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
- link.getTransitionedLayerProtocolName(),
- hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));