use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTransportConfigBuilder 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().setNeighborAddress(NEIGHBOR_ADDRESS).setTransport(transport.build()).build(), null));
assertEquals(PORT, OpenConfigMappingUtil.getPort(new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).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(Uint16.valueOf(111));
final Config portConfig = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().addAugmentation(new NeighborTransportConfigBuilder().setRemotePort(newPort).build()).build();
assertEquals(newPort, OpenConfigMappingUtil.getPort(new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setTransport(transport.setConfig(portConfig).build()).build(), null));
assertEquals(newPort, OpenConfigMappingUtil.getPort(new NeighborBuilder().setNeighborAddress(NEIGHBOR_ADDRESS).setTransport(transport.setConfig(portConfig).build()).build(), EMPTY_PEERGROUP));
final Config portConfigGroup = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().addAugmentation(new PeerGroupTransportConfigBuilder().setRemotePort(newPort).build()).build();
assertEquals(newPort, OpenConfigMappingUtil.getPort(EMPTY_NEIGHBOR, new PeerGroupBuilder().setPeerGroupName("foo").setTransport(transport.setConfig(portConfigGroup).build()).build()));
}
Aggregations