use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.BgpId in project bgpcep by opendaylight.
the class AbstractConfig method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
doReturn(InstanceIdentifier.create(BgpRib.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.Rib.class, new RibKey(RIB_ID))).when(this.rib).getInstanceIdentifier();
doReturn(this.domTx).when(this.rib).createPeerDOMChain(any(DOMTransactionChainListener.class));
doReturn(AS).when(this.rib).getLocalAs();
doReturn(mock(RIBSupportContextRegistry.class)).when(this.rib).getRibSupportContext();
doReturn(Collections.emptySet()).when(this.rib).getLocalTablesKeys();
doNothing().when(this.domTx).close();
doReturn(this.domDW).when(this.domTx).newWriteOnlyTransaction();
doNothing().when(this.domDW).put(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(MapEntryNode.class));
doNothing().when(this.domDW).delete(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class));
doNothing().when(this.domDW).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
doReturn(CommitInfo.emptyFluentFuture()).when(this.domDW).commit();
doReturn(YangInstanceIdentifier.of(Rib.QNAME)).when(this.rib).getYangRibId();
doReturn(this.dataTreeChangeService).when(this.rib).getService();
doReturn(this.listener).when(this.dataTreeChangeService).registerDataTreeChangeListener(any(), any());
doReturn(new BgpId("127.0.0.1")).when(this.rib).getBgpIdentifier();
doReturn(true).when(this.future).cancel(true);
doReturn(this.future).when(this.dispatcher).createReconnectingClient(any(InetSocketAddress.class), any(), anyInt(), any(KeyMapping.class));
doReturn(this.dispatcher).when(this.rib).getDispatcher();
doReturn(new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class)).when(this.tableTypeRegistry).getTableType(any());
doReturn(TABLES_KEY).when(this.tableTypeRegistry).getTableKey(any());
doReturn(Collections.singleton(new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class))).when(this.rib).getLocalTables();
doNothing().when(this.bgpPeerRegistry).addPeer(any(IpAddressNoZone.class), any(BGPSessionListener.class), any(BGPSessionPreferences.class));
doNothing().when(this.bgpPeerRegistry).removePeer(any(IpAddressNoZone.class));
doReturn("registry").when(this.bgpPeerRegistry).toString();
doNothing().when(this.listener).close();
doReturn(this.bgpPeerRegistry).when(this.dispatcher).getBGPPeerRegistry();
doReturn(this.peerTracker).when(this.rib).getPeerTracker();
doReturn(this.policies).when(this.rib).getRibPolicies();
doReturn(null).when(this.peerGroupLoader).getPeerGroup(any(InstanceIdentifier.class), any(String.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.BgpId in project bgpcep by opendaylight.
the class RibImplTest method testRibImpl.
@Test
public void testRibImpl() throws ExecutionException, InterruptedException {
final RibImpl ribImpl = new RibImpl(extension, dispatcher, policyProvider, codecsRegistry, new BGPStateCollector(), domDataBroker);
ribImpl.start(createGlobal(), "rib-test", tableTypeRegistry);
verify(domDataBroker).getExtensions();
assertEquals("RIBImpl{bgpId=Ipv4Address{_value=127.0.0.1}, localTables=[BgpTableTypeImpl [" + "getAfi()=interface org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types." + "rev200120.Ipv4AddressFamily, " + "getSafi()=interface org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types." + "rev200120.UnicastSubsequentAddressFamily]]}", ribImpl.toString());
assertEquals(Collections.singleton(new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class)), ribImpl.getLocalTablesKeys());
assertNotNull(ribImpl.getService());
assertNotNull(ribImpl.getInstanceIdentifier());
assertEquals(AS, ribImpl.getLocalAs());
assertEquals(BGP_ID, ribImpl.getBgpIdentifier());
assertEquals(Collections.singleton(TABLE_TYPE), ribImpl.getLocalTables());
assertEquals(dispatcher, ribImpl.getDispatcher());
assertEquals(extension, ribImpl.getRibExtensions());
assertNotNull(ribImpl.getRibSupportContext());
assertNotNull(ribImpl.getCodecsRegistry());
ribImpl.stop().get();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.BgpId in project bgpcep by opendaylight.
the class AddPathNPathsTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
final TablesKey tk = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(tk, new AddPathBestNPathSelection(2));
this.ribImpl = new RIBImpl(this.tableRegistry, new RibId("test-rib"), AS_NUMBER, new BgpId(RIB_ID), this.ribExtension, this.serverDispatcher, this.codecsRegistry, getDomBroker(), this.policies, TABLES_TYPE, pathTables);
this.ribImpl.instantiateServiceInstance();
final ChannelFuture channelFuture = this.serverDispatcher.createServer(new InetSocketAddress(RIB_ID, PORT.toJava()));
waitFutureSuccess(channelFuture);
this.serverChannel = channelFuture.channel();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.BgpId 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.opendaylight.params.xml.ns.yang.bgp.types.rev200120.BgpId in project bgpcep by opendaylight.
the class AbstractBGPDispatcherTest method createPreferences.
protected BGPSessionPreferences createPreferences(final InetSocketAddress socketAddress) {
final List<BgpParameters> tlvs = new ArrayList<>();
final List<OptionalCapabilities> capas = new ArrayList<>();
capas.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder().setAfi(IPV_4_TT.getAfi()).setSafi(IPV_4_TT.getSafi()).build()).build()).setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(Uint32.valueOf(30))).build()).build()).build());
capas.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capas).build());
final BgpId bgpId = new BgpId(IetfInetUtil.INSTANCE.ipv4AddressFor(socketAddress.getAddress()));
return new BGPSessionPreferences(AS_NUMBER, HOLD_TIMER, bgpId, AS_NUMBER, tlvs);
}
Aggregations