use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.PeerGroupTransportConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method testGetPort.
@Test
public void testGetPort() {
final TransportBuilder transport = new TransportBuilder();
assertEquals(PORT, OpenConfigMappingUtil.getPort(NEIGHBOR, null));
assertEquals(PORT, OpenConfigMappingUtil.getPort(new NeighborBuilder().setTransport(transport.build()).build(), null));
assertEquals(PORT, OpenConfigMappingUtil.getPort(new NeighborBuilder().setTransport(transport.setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().build()).build()).build(), null));
final PortNumber newPort = new PortNumber(111);
final Config portConfig = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().addAugmentation(NeighborTransportConfig.class, new NeighborTransportConfigBuilder().setRemotePort(newPort).build()).build();
assertEquals(newPort, OpenConfigMappingUtil.getPort(new NeighborBuilder().setTransport(transport.setConfig(portConfig).build()).build(), null));
assertEquals(newPort, OpenConfigMappingUtil.getPort(new NeighborBuilder().setTransport(transport.setConfig(portConfig).build()).build(), new PeerGroupBuilder().build()));
final Config portConfigGroup = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().addAugmentation(PeerGroupTransportConfig.class, new PeerGroupTransportConfigBuilder().setRemotePort(newPort).build()).build();
assertEquals(newPort, OpenConfigMappingUtil.getPort(new NeighborBuilder().build(), new PeerGroupBuilder().setTransport(transport.setConfig(portConfigGroup).build()).build()));
}
Aggregations