use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method testGetLocalAddress.
@Test
public void testGetLocalAddress() {
assertNull(OpenConfigMappingUtil.getLocalAddress(null));
final TransportBuilder transport = new TransportBuilder();
assertNull(OpenConfigMappingUtil.getLocalAddress(transport.build()));
assertNull(OpenConfigMappingUtil.getLocalAddress(transport.setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().build()).build()));
assertEquals(new IpAddressNoZone(LOCAL_HOST), OpenConfigMappingUtil.getLocalAddress(transport.setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.ConfigBuilder().setLocalAddress(new BgpNeighborTransportConfig.LocalAddress(new IpAddress(new Ipv4Address(LOCAL_HOST.getValue())))).build()).build()));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class AbstractAddPathTest method createPeerSession.
BGPSessionImpl createPeerSession(final Ipv4AddressNoZone peer, final BgpParameters bgpParameters, final SimpleSessionListener sessionListener, final AsNumber remoteAsNumber) throws InterruptedException {
final StrictBGPPeerRegistry clientRegistry = new StrictBGPPeerRegistry();
final BGPDispatcherImpl clientDispatcher = new BGPDispatcherImpl(this.context, this.boss, this.worker, clientRegistry);
clientDispatchers.add(clientDispatcher);
clientRegistry.addPeer(new IpAddressNoZone(new Ipv4AddressNoZone(RIB_ID)), sessionListener, new BGPSessionPreferences(remoteAsNumber, HOLDTIMER, new BgpId(peer), AS_NUMBER, Lists.newArrayList(bgpParameters)));
return connectPeer(peer, clientDispatcher);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class StrictBGPPeerRegistryTest method testDropFirstPeer.
@Test
public void testDropFirstPeer() throws Exception {
final Ipv4AddressNoZone higher = new Ipv4AddressNoZone("123.123.123.123");
final Ipv4AddressNoZone lower = new Ipv4AddressNoZone("123.123.123.122");
final IpAddressNoZone remoteIp = new IpAddressNoZone(lower);
this.peerRegistry.addPeer(remoteIp, this.peer1, this.mockPreferences);
this.peerRegistry.getPeer(remoteIp, lower, higher, createOpen(higher, LOCAL_AS));
this.peerRegistry.getPeer(remoteIp, higher, lower, createOpen(lower, LOCAL_AS));
verify(this.peer1).releaseConnection();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class StrictBGPPeerRegistryTest method testIpAddressConstruction.
@Test
public void testIpAddressConstruction() throws BGPDocumentedException {
final InetSocketAddress adr = new InetSocketAddress("127.0.0.1", 179);
final IpAddressNoZone ipAdr = StrictBGPPeerRegistry.getIpAddress(adr);
assertEquals("127.0.0.1", ipAdr.getIpv4AddressNoZone().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone in project bgpcep by opendaylight.
the class StrictBGPPeerRegistryTest method testDropSecondPeer.
@Test
public void testDropSecondPeer() throws BGPDocumentedException {
final Ipv4AddressNoZone higher = new Ipv4AddressNoZone("192.168.200.200");
final Ipv4AddressNoZone lower = new Ipv4AddressNoZone("10.10.10.10");
final IpAddressNoZone remoteIp = new IpAddressNoZone(lower);
this.peerRegistry.addPeer(remoteIp, this.peer1, this.mockPreferences);
this.peerRegistry.getPeer(remoteIp, higher, lower, createOpen(lower, LOCAL_AS));
try {
this.peerRegistry.getPeer(remoteIp, lower, higher, createOpen(higher, LOCAL_AS));
} catch (final BGPDocumentedException e) {
assertEquals(BGPError.CEASE, e.getError());
return;
}
fail("Same peer cannot be connected twice");
}
Aggregations