@Test public void testResolveNode2() throws Exception { User user = mock(User.class); Node node = mock(Node.class); VirtualNetwork virtualNetwork = mock(VirtualNetwork.class); UserIntentVnMapping userIntentVnMapping = mock(UserIntentVnMapping.class); when(node.getNodeType()).thenReturn(new NodeType("l3-group")); nodeMapper.resolveNode(user, node, virtualNetwork, userIntentVnMapping); }
protected void resolveNode(User user, Node node, VirtualNetwork virtualNetwork, UserIntentVnMapping userIntentVnMapping) throws IntentResolutionException { NodeType nodeType = node.getNodeType(); if ( nodeType.equals(new NodeType("host")) ) { resolveHost(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType(("l2-group"))) ) { resolveLayer2Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("l3-group")) ) { resolveLayer3Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("ext-group")) ) { if ( IntentResolverUtils.checkExternalLayer3Group(node) ) { resolveExternalLayer3Group(user, node, virtualNetwork, userIntentVnMapping); } return; } if ( nodeType.equals(new NodeType("chain-group")) ) { resolveServiceChainGroup(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("fw")) || nodeType.equals(new NodeType("lb")) || nodeType.equals(new NodeType("cache")) ) { resolveServiceFunction(user, node, virtualNetwork, userIntentVnMapping); return; } throw new IntentResolutionException("Unknown node type."); }
NodeMapper { protected void resolveNode(User user, Node node, VirtualNetwork virtualNetwork, UserIntentVnMapping userIntentVnMapping) throws IntentResolutionException { NodeType nodeType = node.getNodeType(); if ( nodeType.equals(new NodeType("host")) ) { resolveHost(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType(("l2-group"))) ) { resolveLayer2Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("l3-group")) ) { resolveLayer3Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("ext-group")) ) { if ( IntentResolverUtils.checkExternalLayer3Group(node) ) { resolveExternalLayer3Group(user, node, virtualNetwork, userIntentVnMapping); } return; } if ( nodeType.equals(new NodeType("chain-group")) ) { resolveServiceChainGroup(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("fw")) || nodeType.equals(new NodeType("lb")) || nodeType.equals(new NodeType("cache")) ) { resolveServiceFunction(user, node, virtualNetwork, userIntentVnMapping); return; } throw new IntentResolutionException("Unknown node type."); } }
NodeMapper { protected void resolveNode(User user, Node node, VirtualNetwork virtualNetwork, UserIntentVnMapping userIntentVnMapping) throws IntentResolutionException { NodeType nodeType = node.getNodeType(); if ( nodeType.equals(new NodeType("host")) ) { resolveHost(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType(("l2-group"))) ) { resolveLayer2Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("l3-group")) ) { resolveLayer3Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("ext-group")) ) { if ( IntentResolverUtils.checkExternalLayer3Group(node) ) { resolveExternalLayer3Group(user, node, virtualNetwork, userIntentVnMapping); } return; } if ( nodeType.equals(new NodeType("chain-group")) ) { resolveServiceChainGroup(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("fw")) || nodeType.equals(new NodeType("lb")) || nodeType.equals(new NodeType("cache")) ) { resolveServiceFunction(user, node, virtualNetwork, userIntentVnMapping); return; } throw new IntentResolutionException("Unknown node type."); } NodeMapper(DataBroker dataBroker); }
NodeMapper { protected void resolveNode(User user, Node node, VirtualNetwork virtualNetwork, UserIntentVnMapping userIntentVnMapping) throws IntentResolutionException { NodeType nodeType = node.getNodeType(); if ( nodeType.equals(new NodeType("host")) ) { resolveHost(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType(("l2-group"))) ) { resolveLayer2Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("l3-group")) ) { resolveLayer3Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("ext-group")) ) { if ( IntentResolverUtils.checkExternalLayer3Group(node) ) { resolveExternalLayer3Group(user, node, virtualNetwork, userIntentVnMapping); } return; } if ( nodeType.equals(new NodeType("chain-group")) ) { resolveServiceChainGroup(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("fw")) || nodeType.equals(new NodeType("lb")) || nodeType.equals(new NodeType("cache")) ) { resolveServiceFunction(user, node, virtualNetwork, userIntentVnMapping); return; } throw new IntentResolutionException("Unknown node type."); } NodeMapper(DataBroker dataBroker);  }
NodeMapper { protected void resolveNode(User user, Node node, VirtualNetwork virtualNetwork, UserIntentVnMapping userIntentVnMapping) throws IntentResolutionException { NodeType nodeType = node.getNodeType(); if ( nodeType.equals(new NodeType("host")) ) { resolveHost(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType(("l2-group"))) ) { resolveLayer2Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("l3-group")) ) { resolveLayer3Group(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("ext-group")) ) { if ( IntentResolverUtils.checkExternalLayer3Group(node) ) { resolveExternalLayer3Group(user, node, virtualNetwork, userIntentVnMapping); } return; } if ( nodeType.equals(new NodeType("chain-group")) ) { resolveServiceChainGroup(user, node, virtualNetwork, userIntentVnMapping); return; } if ( nodeType.equals(new NodeType("fw")) || nodeType.equals(new NodeType("lb")) || nodeType.equals(new NodeType("cache")) ) { resolveServiceFunction(user, node, virtualNetwork, userIntentVnMapping); return; } throw new IntentResolutionException("Unknown node type."); } NodeMapper(DataBroker dataBroker);   }