SfcSffToOvsMappingAPI { private static List<Options> getSffDataPlaneLocatorOptions(SffDataPlaneLocator sffDataPlaneLocator) { Preconditions.checkNotNull(sffDataPlaneLocator, "Cannot gather SffDataPlaneLocator Options, sffDataPlaneLocator is null."); List<Options> options = new ArrayList<>(); SffOvsLocatorOptionsAugmentation sffDataPlaneLocatorOvsOptions = sffDataPlaneLocator.getAugmentation(SffOvsLocatorOptionsAugmentation.class); if (sffDataPlaneLocatorOvsOptions != null) { OvsOptions ovsOptions = sffDataPlaneLocatorOvsOptions.getOvsOptions(); if (ovsOptions.getLocalIp() != null) { OptionsBuilder optionsLocalIpBuilder = new OptionsBuilder(); optionsLocalIpBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_LOCAL_IP); optionsLocalIpBuilder.setValue(ovsOptions.getLocalIp()); options.add(optionsLocalIpBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_LOCAL_IP); } if (ovsOptions.getRemoteIp() != null) { OptionsBuilder optionsDstIpBuilder = new OptionsBuilder(); optionsDstIpBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_REMOTE_IP); optionsDstIpBuilder.setValue(ovsOptions.getRemoteIp()); options.add(optionsDstIpBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_REMOTE_IP); } if (ovsOptions.getDstPort() != null) { OptionsBuilder optionsDstPortBuilder = new OptionsBuilder(); optionsDstPortBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_DST_PORT); optionsDstPortBuilder.setValue(ovsOptions.getDstPort()); options.add(optionsDstPortBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_DST_PORT); } if (ovsOptions.getKey() != null) { OptionsBuilder optionsKeyBuilder = new OptionsBuilder(); optionsKeyBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_KEY); optionsKeyBuilder.setValue(ovsOptions.getKey()); options.add(optionsKeyBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_KEY); } if (ovsOptions.getNsp() != null) { OptionsBuilder optionsNspBuilder = new OptionsBuilder(); optionsNspBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_NSP); optionsNspBuilder.setValue(ovsOptions.getNsp()); options.add(optionsNspBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_NSP); } if (ovsOptions.getNsi() != null) { OptionsBuilder optionsNsiBuilder = new OptionsBuilder(); optionsNsiBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_NSI); optionsNsiBuilder.setValue(ovsOptions.getNsi()); options.add(optionsNsiBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_NSI); } if (ovsOptions.getExts() != null) { OptionsBuilder optionsExtsBuilder = new OptionsBuilder(); optionsExtsBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_EXTS); optionsExtsBuilder.setValue(ovsOptions.getExts()); options.add(optionsExtsBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_EXTS); } if (ovsOptions.getInNsp() != null) { OptionsBuilder optionsInNspBuilder = new OptionsBuilder(); optionsInNspBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_IN_NSP); optionsInNspBuilder.setValue(ovsOptions.getInNsp()); options.add(optionsInNspBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_IN_NSP); } if (ovsOptions.getInNsi() != null) { OptionsBuilder optionsInNsiBuilder = new OptionsBuilder(); optionsInNsiBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_IN_NSI); optionsInNsiBuilder.setValue(ovsOptions.getInNsi()); options.add(optionsInNsiBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_IN_NSI); } if (ovsOptions.getOutNsp() != null) { OptionsBuilder optionsOutNspBuilder = new OptionsBuilder(); optionsOutNspBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_OUT_NSP); optionsOutNspBuilder.setValue(ovsOptions.getOutNsp()); options.add(optionsOutNspBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_OUT_NSP); } if (ovsOptions.getOutNsi() != null) { OptionsBuilder optionsOutNsiBuilder = new OptionsBuilder(); optionsOutNsiBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_OUT_NSI); optionsOutNsiBuilder.setValue(ovsOptions.getOutNsi()); options.add(optionsOutNsiBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_OUT_NSI); } if (ovsOptions.getNshc1() != null) { OptionsBuilder optionsNsiBuilder = new OptionsBuilder(); optionsNsiBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_NSHC1); optionsNsiBuilder.setValue(ovsOptions.getNshc1()); options.add(optionsNsiBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_NSHC1); } if (ovsOptions.getNshc2() != null) { OptionsBuilder optionsNsiBuilder = new OptionsBuilder(); optionsNsiBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_NSHC2); optionsNsiBuilder.setValue(ovsOptions.getNshc2()); options.add(optionsNsiBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_NSHC2); } if (ovsOptions.getNshc3() != null) { OptionsBuilder optionsNsiBuilder = new OptionsBuilder(); optionsNsiBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_NSHC3); optionsNsiBuilder.setValue(ovsOptions.getNshc3()); options.add(optionsNsiBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_NSHC3); } if (ovsOptions.getNshc4() != null) { OptionsBuilder optionsNsiBuilder = new OptionsBuilder(); optionsNsiBuilder.setOption(SfcOvsUtil.OVSDB_OPTION_NSHC4); optionsNsiBuilder.setValue(ovsOptions.getNshc4()); options.add(optionsNsiBuilder.build()); } else { LOG.debug("Option: {} is null.", SfcOvsUtil.OVSDB_OPTION_NSHC4); } } return options; }  static OvsdbBridgeAugmentation buildOvsdbBridgeAugmentation(
            ServiceFunctionForwarder serviceFunctionForwarder, ExecutorService executor); static List<OvsdbTerminationPointAugmentation> buildTerminationPointAugmentationList(
            List<SffDataPlaneLocator> sffDataPlaneLocatorList);  }
@Test public void getSffDataPlaneLocatorOptionsTest() throws Exception { optionsList = new ArrayList<>(); ovsOptionsBuilder = new OvsOptionsBuilder(); ovsdbTerminationPointAugmentationList = new ArrayList<>(); sffDataPlaneLocatorBuilder = new SffDataPlaneLocatorBuilder(); sffOvsLocatorOptionsAugmentationBuilder = new SffOvsLocatorOptionsAugmentationBuilder(); ovsOptionsBuilder.setLocalIp(OVSDB_OPTION_LOCAL_IP_VALUE) .setRemoteIp(OVSDB_OPTION_REMOTE_IP_VALUE) .setDstPort(OVSDB_OPTION_DST_PORT_VALUE) .setKey(OVSDB_OPTION_KEY) .setNsp(OVSDB_OPTION_NSP) .setNsi(OVSDB_OPTION_NSI) .setNshc1(OVSDB_OPTION_NSHC1) .setNshc2(OVSDB_OPTION_NSHC2) .setNshc3(OVSDB_OPTION_NSHC3) .setNshc4(OVSDB_OPTION_NSHC4); sffOvsLocatorOptionsAugmentationBuilder.setOvsOptions(ovsOptionsBuilder.build()); sffDataPlaneLocatorBuilder.addAugmentation(SffOvsLocatorOptionsAugmentation.class, sffOvsLocatorOptionsAugmentationBuilder.build()); optionsList = Whitebox.invokeMethod(SfcSffToOvsMappingAPI.class, "getSffDataPlaneLocatorOptions", sffDataPlaneLocatorBuilder.build()); assertEquals("Local Ip must be Equal", optionsList.get(0).getValue(), OVSDB_OPTION_LOCAL_IP_VALUE); assertEquals("Remote Ip must be Equal", optionsList.get(1).getValue(), OVSDB_OPTION_REMOTE_IP_VALUE); assertEquals("Dst must be Equal", optionsList.get(2).getValue(), OVSDB_OPTION_DST_PORT_VALUE); assertEquals("Key must be Equal", optionsList.get(3).getValue(), OVSDB_OPTION_KEY); assertEquals("Nsp must be Equal", optionsList.get(4).getValue(), OVSDB_OPTION_NSP); assertEquals("Nsi must be Equal", optionsList.get(5).getValue(), OVSDB_OPTION_NSI); assertEquals("Nshc1 must be Equal", optionsList.get(6).getValue(), OVSDB_OPTION_NSHC1); assertEquals("Nshc2 must be Equal", optionsList.get(7).getValue(), OVSDB_OPTION_NSHC2); assertEquals("Nshc3 must be Equal", optionsList.get(8).getValue(), OVSDB_OPTION_NSHC3); assertEquals("Nshc4 must be Equal", optionsList.get(9).getValue(), OVSDB_OPTION_NSHC4); }