@Test public void testCreateAbstractFlow() throws Exception { String name = new String("name"); String value = new String("value"); String Value = NEMOConstants.string; String matchName = new String("matchName"); LinkedHashMap<String,String> values = new LinkedHashMap<String, String>(); LinkedHashMap<String,LinkedHashMap<String,String>> matches = new LinkedHashMap<String, LinkedHashMap<String, String>>(); LinkedHashMap<String,LinkedHashMap<String,String>> propertyList = new LinkedHashMap<String, LinkedHashMap<String, String>>(); matches.put(matchName,values); values.put(value,Value); Assert.assertTrue(updateTemplateDefinitionLang.createAbstractFlow(name, matches, propertyList) == null); values.clear(); values.put("11", NEMOConstants.integer); Assert.assertTrue(updateTemplateDefinitionLang.createAbstractFlow(name, matches, propertyList) == null); values.clear(); values.put("1,1", NEMOConstants.range); Assert.assertTrue(updateTemplateDefinitionLang.createAbstractFlow(name, matches, propertyList) == null); }
public String createAbstractFlow(String name,LinkedHashMap<String,LinkedHashMap<String,String>> matches,LinkedHashMap<String,LinkedHashMap<String,String>> propertyList){ AbstractFlowBuilder flowBuilder = new AbstractFlowBuilder(); FlowId flowId = new FlowId(UUID.randomUUID().toString()); flowBuilder.setKey(new AbstractFlowKey(flowId)) .setFlowId(flowId) .setFlowName(new FlowName(name)); List<MatchItem> matchItemList = new LinkedList<MatchItem>(); for (String matchName : matches.keySet()){ MatchItemBuilder matchItemBuilder = new MatchItemBuilder(); matchItemBuilder.setKey(new MatchItemKey(new MatchItemName(matchName))) .setMatchItemName(new MatchItemName(matchName)); MatchItemValueBuilder valueBuilder = new MatchItemValueBuilder(); Map<String, String> values = matches.get(matchName); for (String value : values.keySet()){ if (values.get(value).equals(NEMOConstants.string)){ valueBuilder.setStringValue(value); } if (values.get(value).equals(NEMOConstants.integer)){ valueBuilder.setIntValue(Long.parseLong(value)); } if (values.get(value).equals(NEMOConstants.range)){ String[] range = value.split(","); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder rangeValueBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder(); rangeValueBuilder.setMax(Long.parseLong(range[0]) > Long.parseLong(range[1]) ? Long.parseLong(range[0]) : Long.parseLong(range[1])); rangeValueBuilder.setMin(Long.parseLong(range[0])<Long.parseLong(range[1])?Long.parseLong(range[0]):Long.parseLong(range[1])); valueBuilder.setRangeValue(rangeValueBuilder.build()); } } matchItemBuilder.setMatchItemValue(valueBuilder.build()); matchItemList.add(matchItemBuilder.build()); } flowBuilder.setMatchItem(matchItemList); abstractFlows.put(new FlowName(name), flowBuilder.build()); return null; }
UpdateTemplateDefinitionLang { public String createAbstractFlow(String name,LinkedHashMap<String,LinkedHashMap<String,String>> matches,LinkedHashMap<String,LinkedHashMap<String,String>> propertyList){ AbstractFlowBuilder flowBuilder = new AbstractFlowBuilder(); FlowId flowId = new FlowId(UUID.randomUUID().toString()); flowBuilder.setKey(new AbstractFlowKey(flowId)) .setFlowId(flowId) .setFlowName(new FlowName(name)); List<MatchItem> matchItemList = new LinkedList<MatchItem>(); for (String matchName : matches.keySet()){ MatchItemBuilder matchItemBuilder = new MatchItemBuilder(); matchItemBuilder.setKey(new MatchItemKey(new MatchItemName(matchName))) .setMatchItemName(new MatchItemName(matchName)); MatchItemValueBuilder valueBuilder = new MatchItemValueBuilder(); Map<String, String> values = matches.get(matchName); for (String value : values.keySet()){ if (values.get(value).equals(NEMOConstants.string)){ valueBuilder.setStringValue(value); } if (values.get(value).equals(NEMOConstants.integer)){ valueBuilder.setIntValue(Long.parseLong(value)); } if (values.get(value).equals(NEMOConstants.range)){ String[] range = value.split(","); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder rangeValueBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder(); rangeValueBuilder.setMax(Long.parseLong(range[0]) > Long.parseLong(range[1]) ? Long.parseLong(range[0]) : Long.parseLong(range[1])); rangeValueBuilder.setMin(Long.parseLong(range[0])<Long.parseLong(range[1])?Long.parseLong(range[0]):Long.parseLong(range[1])); valueBuilder.setRangeValue(rangeValueBuilder.build()); } } matchItemBuilder.setMatchItemValue(valueBuilder.build()); matchItemList.add(matchItemBuilder.build()); } flowBuilder.setMatchItem(matchItemList); abstractFlows.put(new FlowName(name), flowBuilder.build()); return null; } }
UpdateTemplateDefinitionLang { public String createAbstractFlow(String name,LinkedHashMap<String,LinkedHashMap<String,String>> matches,LinkedHashMap<String,LinkedHashMap<String,String>> propertyList){ AbstractFlowBuilder flowBuilder = new AbstractFlowBuilder(); FlowId flowId = new FlowId(UUID.randomUUID().toString()); flowBuilder.setKey(new AbstractFlowKey(flowId)) .setFlowId(flowId) .setFlowName(new FlowName(name)); List<MatchItem> matchItemList = new LinkedList<MatchItem>(); for (String matchName : matches.keySet()){ MatchItemBuilder matchItemBuilder = new MatchItemBuilder(); matchItemBuilder.setKey(new MatchItemKey(new MatchItemName(matchName))) .setMatchItemName(new MatchItemName(matchName)); MatchItemValueBuilder valueBuilder = new MatchItemValueBuilder(); Map<String, String> values = matches.get(matchName); for (String value : values.keySet()){ if (values.get(value).equals(NEMOConstants.string)){ valueBuilder.setStringValue(value); } if (values.get(value).equals(NEMOConstants.integer)){ valueBuilder.setIntValue(Long.parseLong(value)); } if (values.get(value).equals(NEMOConstants.range)){ String[] range = value.split(","); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder rangeValueBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder(); rangeValueBuilder.setMax(Long.parseLong(range[0]) > Long.parseLong(range[1]) ? Long.parseLong(range[0]) : Long.parseLong(range[1])); rangeValueBuilder.setMin(Long.parseLong(range[0])<Long.parseLong(range[1])?Long.parseLong(range[0]):Long.parseLong(range[1])); valueBuilder.setRangeValue(rangeValueBuilder.build()); } } matchItemBuilder.setMatchItemValue(valueBuilder.build()); matchItemList.add(matchItemBuilder.build()); } flowBuilder.setMatchItem(matchItemList); abstractFlows.put(new FlowName(name), flowBuilder.build()); return null; } UpdateTemplateDefinitionLang(DataBroker dataBroker, TenantManage tenantManage); }
UpdateTemplateDefinitionLang { public String createAbstractFlow(String name,LinkedHashMap<String,LinkedHashMap<String,String>> matches,LinkedHashMap<String,LinkedHashMap<String,String>> propertyList){ AbstractFlowBuilder flowBuilder = new AbstractFlowBuilder(); FlowId flowId = new FlowId(UUID.randomUUID().toString()); flowBuilder.setKey(new AbstractFlowKey(flowId)) .setFlowId(flowId) .setFlowName(new FlowName(name)); List<MatchItem> matchItemList = new LinkedList<MatchItem>(); for (String matchName : matches.keySet()){ MatchItemBuilder matchItemBuilder = new MatchItemBuilder(); matchItemBuilder.setKey(new MatchItemKey(new MatchItemName(matchName))) .setMatchItemName(new MatchItemName(matchName)); MatchItemValueBuilder valueBuilder = new MatchItemValueBuilder(); Map<String, String> values = matches.get(matchName); for (String value : values.keySet()){ if (values.get(value).equals(NEMOConstants.string)){ valueBuilder.setStringValue(value); } if (values.get(value).equals(NEMOConstants.integer)){ valueBuilder.setIntValue(Long.parseLong(value)); } if (values.get(value).equals(NEMOConstants.range)){ String[] range = value.split(","); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder rangeValueBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder(); rangeValueBuilder.setMax(Long.parseLong(range[0]) > Long.parseLong(range[1]) ? Long.parseLong(range[0]) : Long.parseLong(range[1])); rangeValueBuilder.setMin(Long.parseLong(range[0])<Long.parseLong(range[1])?Long.parseLong(range[0]):Long.parseLong(range[1])); valueBuilder.setRangeValue(rangeValueBuilder.build()); } } matchItemBuilder.setMatchItemValue(valueBuilder.build()); matchItemList.add(matchItemBuilder.build()); } flowBuilder.setMatchItem(matchItemList); abstractFlows.put(new FlowName(name), flowBuilder.build()); return null; } UpdateTemplateDefinitionLang(DataBroker dataBroker, TenantManage tenantManage); String templateDefinitionLang(UserId userId, String templateName, LinkedHashMap<String, String> parameters); String createAbstractNode(String name, String type, List<String> subnodes, LinkedHashMap<String, LinkedHashMap<String,String>> propertyList); String createAbstractConnection(String name, String type, List<String> endnodes, LinkedHashMap<String, LinkedHashMap<String,String>> propertyList); String createAbstractFlow(String name,LinkedHashMap<String,LinkedHashMap<String,String>> matches,LinkedHashMap<String,LinkedHashMap<String,String>> propertyList); String createAbstractOperation(String name, String target, String priority, LinkedHashMap<String,LinkedHashMap<String,String>> conditions,LinkedHashMap<String,LinkedHashMap<String,String>>actions); }
UpdateTemplateDefinitionLang { public String createAbstractFlow(String name,LinkedHashMap<String,LinkedHashMap<String,String>> matches,LinkedHashMap<String,LinkedHashMap<String,String>> propertyList){ AbstractFlowBuilder flowBuilder = new AbstractFlowBuilder(); FlowId flowId = new FlowId(UUID.randomUUID().toString()); flowBuilder.setKey(new AbstractFlowKey(flowId)) .setFlowId(flowId) .setFlowName(new FlowName(name)); List<MatchItem> matchItemList = new LinkedList<MatchItem>(); for (String matchName : matches.keySet()){ MatchItemBuilder matchItemBuilder = new MatchItemBuilder(); matchItemBuilder.setKey(new MatchItemKey(new MatchItemName(matchName))) .setMatchItemName(new MatchItemName(matchName)); MatchItemValueBuilder valueBuilder = new MatchItemValueBuilder(); Map<String, String> values = matches.get(matchName); for (String value : values.keySet()){ if (values.get(value).equals(NEMOConstants.string)){ valueBuilder.setStringValue(value); } if (values.get(value).equals(NEMOConstants.integer)){ valueBuilder.setIntValue(Long.parseLong(value)); } if (values.get(value).equals(NEMOConstants.range)){ String[] range = value.split(","); org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder rangeValueBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.object.rev151010.match.item.instance.match.item.value.RangeValueBuilder(); rangeValueBuilder.setMax(Long.parseLong(range[0]) > Long.parseLong(range[1]) ? Long.parseLong(range[0]) : Long.parseLong(range[1])); rangeValueBuilder.setMin(Long.parseLong(range[0])<Long.parseLong(range[1])?Long.parseLong(range[0]):Long.parseLong(range[1])); valueBuilder.setRangeValue(rangeValueBuilder.build()); } } matchItemBuilder.setMatchItemValue(valueBuilder.build()); matchItemList.add(matchItemBuilder.build()); } flowBuilder.setMatchItem(matchItemList); abstractFlows.put(new FlowName(name), flowBuilder.build()); return null; } UpdateTemplateDefinitionLang(DataBroker dataBroker, TenantManage tenantManage); String templateDefinitionLang(UserId userId, String templateName, LinkedHashMap<String, String> parameters); String createAbstractNode(String name, String type, List<String> subnodes, LinkedHashMap<String, LinkedHashMap<String,String>> propertyList); String createAbstractConnection(String name, String type, List<String> endnodes, LinkedHashMap<String, LinkedHashMap<String,String>> propertyList); String createAbstractFlow(String name,LinkedHashMap<String,LinkedHashMap<String,String>> matches,LinkedHashMap<String,LinkedHashMap<String,String>> propertyList); String createAbstractOperation(String name, String target, String priority, LinkedHashMap<String,LinkedHashMap<String,String>> conditions,LinkedHashMap<String,LinkedHashMap<String,String>>actions);  }