SfcIosXeUtils { public static SfDataPlaneLocator getDplWithIpLocatorType(List<SfDataPlaneLocator> dataPlaneLocators) { if (dataPlaneLocators == null) { return null; } for (SfDataPlaneLocator sfDataPlaneLocator : dataPlaneLocators) { LocatorType locatorType = sfDataPlaneLocator.getLocatorType(); if (locatorType instanceof Ip) { return sfDataPlaneLocator; } } return null; }  static org.opendaylight.yang.gen.v1.urn.ios.rev160308._native.service.chain.ServiceFunctionForwarder createLocalForwarder(
            IpAddress ipAddress); static ServiceFfName createRemoteForwarder(SffName sffName); static SfDataPlaneLocator getDplWithIpLocatorType(List<SfDataPlaneLocator> dataPlaneLocators);  }
@Test public void getDplWithIpLocatorType_noIpLocator() { List<SfDataPlaneLocator> dataPlaneLocators = new ArrayList<>(); org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.base.SfDataPlaneLocatorBuilder macLocatorTypeBuilder = new org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.base.SfDataPlaneLocatorBuilder(); macLocatorTypeBuilder.setLocatorType(new MacBuilder().build()); dataPlaneLocators.add(macLocatorTypeBuilder.build()); SfDataPlaneLocator result = SfcIosXeUtils.getDplWithIpLocatorType(dataPlaneLocators); assertNull(result); }
@Test public void getDplWithIpLocatorType() { List<SfDataPlaneLocator> dataPlaneLocators = new ArrayList<>(); org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.base.SfDataPlaneLocatorBuilder macLocatorTypeBuilder = new org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.base.SfDataPlaneLocatorBuilder(); macLocatorTypeBuilder.setLocatorType(new MacBuilder().build()); SfDataPlaneLocator macLocatorDpl = macLocatorTypeBuilder.build(); org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.base.SfDataPlaneLocatorBuilder ipLocatorTypeBuilder = new org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sf.rev140701.service.function.base.SfDataPlaneLocatorBuilder(); ipLocatorTypeBuilder.setLocatorType(new IpBuilder().build()); SfDataPlaneLocator ipLocatorDpl = ipLocatorTypeBuilder.build(); dataPlaneLocators.add(macLocatorDpl); dataPlaneLocators.add(ipLocatorDpl); SfDataPlaneLocator result = SfcIosXeUtils.getDplWithIpLocatorType(dataPlaneLocators); assertNotNull(result); }