public void setUp() {
MockitoAnnotations.initMocks(this);
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
- final InstanceIdentifier<Rib> iid = InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(new RibId("test-rib"))).toInstance();
+ final InstanceIdentifier<Rib> iid = InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(new RibId("test-rib"))).build();
final KeyedInstanceIdentifier<Tables, TablesKey> key = iid.child(LocRib.class).child(Tables.class, new TablesKey(LinkstateAddressFamily.class,
LinkstateSubsequentAddressFamily.class));
public RIBImpl(final RibId ribId, final AsNumber localAs, final Ipv4Address localBgpId, final RIBExtensionConsumerContext extensions,
final BGPDispatcher dispatcher, final ReconnectStrategyFactory tcpStrategyFactory,
final ReconnectStrategyFactory sessionStrategyFactory, final DataBroker dps, final List<BgpTableType> localTables) {
- super(InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(Preconditions.checkNotNull(ribId))).toInstance());
+ super(InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(Preconditions.checkNotNull(ribId))).build());
this.chain = dps.createTransactionChain(this);
this.localAs = Preconditions.checkNotNull(localAs);
this.comparator = new BGPObjectComparator(localAs);
private WriteTransaction trans;
- private final DefaultRibReference rib = new DefaultRibReference(InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(new RibId("test"))).toInstance());
+ private final DefaultRibReference rib = new DefaultRibReference(InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(new RibId("test"))).build());
private final RIBActivator act = new RIBActivator();
private static final Ipv4Prefix IPV4_PREFIX2 = new Ipv4Prefix("2.2.2.2/32");
- private static final InstanceIdentifier<Rib> RIB_IID = InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(new RibId("test-rib"))).toInstance();
+ private static final InstanceIdentifier<Rib> RIB_IID = InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(new RibId("test-rib"))).build();
private static final KeyedInstanceIdentifier<Tables, TablesKey> TABLES_IID = RIB_IID.child(LocRib.class).child(Tables.class, new TablesKey(Ipv4AddressFamily.class,
UnicastSubsequentAddressFamily.class));
this.chain = dataProvider.createTransactionChain(this);
final TopologyKey tk = new TopologyKey(Preconditions.checkNotNull(topologyId));
- this.topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, tk).toInstance();
+ this.topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, tk).build();
LOG.debug("Initiating topology builder from {} at {}", locRibReference, this.topology);
public final InstanceIdentifier<Tables> tableInstanceIdentifier(final Class<? extends AddressFamily> afi,
final Class<? extends SubsequentAddressFamily> safi) {
- return this.locRibReference.getInstanceIdentifier().builder().child(LocRib.class).child(Tables.class, new TablesKey(afi, safi)).toInstance();
+ return this.locRibReference.getInstanceIdentifier().builder().child(LocRib.class).child(Tables.class, new TablesKey(afi, safi)).build();
}
protected abstract void createObject(ReadWriteTransaction trans, InstanceIdentifier<T> id, T value);
public abstract class AbstractTopologyBuilderTest extends AbstractDataBrokerTest {
protected static final TopologyId TEST_TOPOLOGY_ID = new TopologyId("test-topo");
- protected static RibReference LOC_RIB_REF = new DefaultRibReference(InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(Preconditions.checkNotNull(new RibId("test-rib")))).toInstance());
+ protected static RibReference LOC_RIB_REF = new DefaultRibReference(InstanceIdentifier.builder(BgpRib.class).child(Rib.class, new RibKey(Preconditions.checkNotNull(new RibId("test-rib")))).build());
protected ListenerRegistration<DataChangeListener> reg;
protected void createEmptyTopology() {
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
- wTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(NetworkTopology.class).toInstance(), new NetworkTopologyBuilder().setTopology(Collections.<Topology>emptyList()).build());
+ wTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(NetworkTopology.class).build(), new NetworkTopologyBuilder().setTopology(Collections.<Topology>emptyList()).build());
wTx.submit();
}
wTx.put(LogicalDatastoreType.OPERATIONAL, path, new TablesBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
.setAttributes(new AttributesBuilder().setUptodate(Boolean.TRUE).build()).setRoutes(new Ipv4RoutesCaseBuilder().build()).build(), true);
wTx.submit();
- this.ipv4RouteIID = path.builder().child(Ipv4Routes.class).child(Ipv4Route.class, new Ipv4RouteKey(new Ipv4Prefix(ROUTE_IP4PREFIX))).toInstance();
+ this.ipv4RouteIID = path.builder().child(Ipv4Routes.class).child(Ipv4Route.class, new Ipv4RouteKey(new Ipv4Prefix(ROUTE_IP4PREFIX))).build();
}
@Test
wTx.put(LogicalDatastoreType.OPERATIONAL, path, new TablesBuilder().setAfi(Ipv6AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
.setAttributes(new AttributesBuilder().setUptodate(Boolean.TRUE).build()).setRoutes(new Ipv6RoutesCaseBuilder().build()).build(), true);
wTx.submit();
- this.ipv6RouteIID = path.builder().child(Ipv6Routes.class).child(Ipv6Route.class, new Ipv6RouteKey(new Ipv6Prefix(ROUTE_IP6PREFIX))).toInstance();
+ this.ipv6RouteIID = path.builder().child(Ipv6Routes.class).child(Ipv6Route.class, new Ipv6RouteKey(new Ipv6Prefix(ROUTE_IP6PREFIX))).build();
}
@Test
wTx.put(LogicalDatastoreType.OPERATIONAL, path, new TablesBuilder().setAfi(LinkstateAddressFamily.class).setSafi(LinkstateSubsequentAddressFamily.class)
.setAttributes(new AttributesBuilder().setUptodate(Boolean.TRUE).build()).setRoutes(new LinkstateRoutesCaseBuilder().build()).build(), true);
wTx.submit();
- this.linkstateRouteIID = (InstanceIdentifier<LinkstateRoute>) path.builder().child((Class)LinkstateRoutes.class).child(LinkstateRoute.class, new LinkstateRouteKey(LINKSTATE_ROUTE_KEY)).toInstance();
+ this.linkstateRouteIID = (InstanceIdentifier<LinkstateRoute>) path.builder().child((Class)LinkstateRoutes.class).child(LinkstateRoute.class, new LinkstateRouteKey(LINKSTATE_ROUTE_KEY)).build();
}
@Test
public class DefaultInstanceReferenceTest {
- private static final InstanceIdentifier<NetworkTopology> IID = InstanceIdentifier.builder(NetworkTopology.class).toInstance();
+ private static final InstanceIdentifier<NetworkTopology> IID = InstanceIdentifier.builder(NetworkTopology.class).build();
@Test
public void testDefaultInstanceReference() {
public java.lang.AutoCloseable createInstance() {
final TopologyDataChangeCounter counter = new TopologyDataChangeCounter(getDataProviderDependency());
final InstanceIdentifier<Topology> topoIId = InstanceIdentifier.builder(NetworkTopology.class)
- .child(Topology.class, new TopologyKey(new TopologyId(getTopologyName()))).toInstance();
+ .child(Topology.class, new TopologyKey(new TopologyId(getTopologyName()))).build();
final ListenerRegistration<DataChangeListener> registration = getDataProviderDependency().registerDataChangeListener(
LogicalDatastoreType.OPERATIONAL, topoIId, counter, DataBroker.DataChangeScope.SUBTREE);
return new DataChangeCounterCloseable(counter, registration);
private static final Logger LOG = LoggerFactory.getLogger(TopologyDataChangeCounter.class);
protected static final InstanceIdentifier<DataChangeCounter> IID = InstanceIdentifier
- .builder(DataChangeCounter.class).toInstance();
+ .builder(DataChangeCounter.class).build();
private final DataBroker dataBroker;
private AtomicLong count;
assertNotNull(getBroker());
final InstanceIdentifier<Topology> topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(getTopologyId("Topo1"))).toInstance();
+ new TopologyKey(getTopologyId("Topo1"))).build();
BindingAwareProvider provider1 = new AbstractTestProvider() {
broker.registerProvider(provider1, getBundleContext());
final InstanceIdentifier<Topology> topology2 = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(getTopologyId("Topo2"))).toInstance();
+ new TopologyKey(getTopologyId("Topo2"))).build();
BindingAwareProvider provider2 = new AbstractTestProvider() {
assertNotNull(getBroker());
final InstanceIdentifier<Topology> topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(getTopologyId("Topo1"))).toInstance();
+ new TopologyKey(getTopologyId("Topo1"))).build();
BindingAwareProvider provider1 = new AbstractTestProvider() {
broker.registerProvider(provider1, getBundleContext());
final InstanceIdentifier<Topology> topology2 = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(getTopologyId("Topo2"))).toInstance();
+ new TopologyKey(getTopologyId("Topo2"))).build();
BindingAwareProvider provider2 = new AbstractTestProvider() {
assertNotNull(getBroker());
final InstanceIdentifier<Topology> topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(getTopologyId("Topo1"))).toInstance();
+ new TopologyKey(getTopologyId("Topo1"))).build();
BindingAwareProvider provider1 = new AbstractTestProvider() {
broker.registerProvider(provider1, getBundleContext());
final InstanceIdentifier<Topology> topology2 = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(getTopologyId("Topo2"))).toInstance();
+ new TopologyKey(getTopologyId("Topo2"))).build();
BindingAwareProvider provider2 = new AbstractTestProvider() {
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
@Override
public java.lang.AutoCloseable createInstance() {
final InstanceIdentifier<Topology> topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(getTopologyId())).toInstance();
+ new TopologyKey(getTopologyId())).build();
final InetSocketAddress address = new InetSocketAddress(listenAddress(), getListenPort().getValue());
final KeyMapping keys = contructKeys();
protected static final String TEST_TOPOLOGY_NAME = "testtopo";
protected static final InstanceIdentifier<Topology> TOPO_IID = InstanceIdentifier.builder(NetworkTopology.class).child(
- Topology.class, new TopologyKey(new TopologyId(TEST_TOPOLOGY_NAME))).toInstance();
+ Topology.class, new TopologyKey(new TopologyId(TEST_TOPOLOGY_NAME))).build();
protected static final String TEST_ADDRESS = "127.0.0.1";
protected static final NodeId NODE_ID = new NodeId("pcc://" + TEST_ADDRESS);
protected static final String TEST_LSP_NAME = "tunnel0";
}
for (final ReportedLsp l : pccnode.getPathComputationClient().getReportedLsp()) {
- lsps.add(id.builder().augmentation(Node1.class).child(PathComputationClient.class).child(ReportedLsp.class, l.getKey()).toInstance());
+ lsps.add(id.builder().augmentation(Node1.class).child(PathComputationClient.class).child(ReportedLsp.class, l.getKey()).build());
}
}
for (final IpAddress a : ((Ip) tpt).getIpAddress()) {
if (addr.equals(a)) {
handleSni(sni, n, inControl, trans);
- return this.target.builder().child(Node.class, n.getKey()).child(TerminationPoint.class, tp.getKey()).toInstance();
+ return this.target.builder().child(Node.class, n.getKey()).child(TerminationPoint.class, tp.getKey()).build();
}
}
} else {
}
private InstanceIdentifier<TerminationPoint> tpIdentifier(final NodeId node, final TpId tp) {
- return this.target.builder().child(Node.class, new NodeKey(node)).child(TerminationPoint.class, new TerminationPointKey(tp)).toInstance();
+ return this.target.builder().child(Node.class, new NodeKey(node)).child(TerminationPoint.class, new TerminationPointKey(tp)).build();
}
private InstanceIdentifier<Node> nodeIdentifier(final NodeId node) {
public static PCEPTunnelTopologyProvider create(final DataBroker dataProvider,
final InstanceIdentifier<Topology> sourceTopology, final TopologyId targetTopology) {
final InstanceIdentifier<Topology> dst = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(targetTopology)).toInstance();
+ new TopologyKey(targetTopology)).build();
final NodeChangedListener ncl = new NodeChangedListener(dataProvider, dst);
final InstanceIdentifier<Node> src = sourceTopology.child(Node.class);
final BindingAwareBroker.RoutedRpcRegistration<TopologyTunnelPcepProgrammingService> reg = getRpcRegistryDependency().addRoutedRpcImplementation(
TopologyTunnelPcepProgrammingService.class, tp);
final InstanceIdentifier<Topology> topology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
- new TopologyKey(getTopologyId())).toInstance();
+ new TopologyKey(getTopologyId())).build();
reg.registerPath(NetworkTopologyContext.class, topology);
final class TunnelTopologyReferenceCloseable extends DefaultTopologyReference implements AutoCloseable {
private static final String LSP2_NAME = "lsp2";
private static final long LSP2_ID = 2;
- private static final InstanceIdentifier<Topology> PCEP_TOPO_IID = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(PCEP_TOPOLOGY_ID)).toInstance();
- private static final InstanceIdentifier<Topology> TUNNEL_TOPO_IID = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(TUNNEL_TOPOLOGY_ID)).toInstance();
+ private static final InstanceIdentifier<Topology> PCEP_TOPO_IID = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(PCEP_TOPOLOGY_ID)).build();
+ private static final InstanceIdentifier<Topology> TUNNEL_TOPO_IID = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(TUNNEL_TOPOLOGY_ID)).build();
private ListenerRegistration<DataChangeListener> listenerRegistration;
node1Builder.setPathComputationClient(new PathComputationClientBuilder().setStateSync(PccSyncState.Synchronized).setReportedLsp(Lists.newArrayList(reportedLps)).setIpAddress(new IpAddress(new Ipv4Address(ipv4Address))).build());
nodeBuilder.addAugmentation(Node1.class, node1Builder.build());
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
- wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID.builder().child(Node.class, new NodeKey(nodeId)).toInstance(), nodeBuilder.build());
+ wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID.builder().child(Node.class, new NodeKey(nodeId)).build(), nodeBuilder.build());
wTx.submit().checkedGet();
}
private void removeNode(final NodeId nodeId) throws TransactionCommitFailedException {
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
- wTx.delete(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID.builder().child(Node.class, new NodeKey(nodeId)).toInstance());
+ wTx.delete(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID.builder().child(Node.class, new NodeKey(nodeId)).build());
wTx.submit().checkedGet();
}
public class TunnelProgrammingTest extends AbstractDataBrokerTest {
private static final TopologyId TOPOLOGY_ID = new TopologyId("tunnel-topo");
- private static final InstanceIdentifier<Topology> TOPO_IID = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(TOPOLOGY_ID)).toInstance();
+ private static final InstanceIdentifier<Topology> TOPO_IID = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(TOPOLOGY_ID)).build();
private static final String NODE1_IPV4 = "127.0.0.1";
private static final NodeId NODE1_ID = new NodeId("pcc://" + NODE1_IPV4);
linkBuilder.setKey(new LinkKey(LINK1_ID));
linkBuilder.addAugmentation(Link1.class, new Link1Builder().setSymbolicPathName(LINK1_ID.getValue()).build());
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
- wTx.put(LogicalDatastoreType.OPERATIONAL, TOPO_IID.builder().child(Link.class, new LinkKey(LINK1_ID)).toInstance(), linkBuilder.build(), true);
+ wTx.put(LogicalDatastoreType.OPERATIONAL, TOPO_IID.builder().child(Link.class, new LinkKey(LINK1_ID)).build(), linkBuilder.build(), true);
wTx.submit().checkedGet();
}
this.notifs = Preconditions.checkNotNull(notifs);
this.executor = Preconditions.checkNotNull(executor);
this.timer = Preconditions.checkNotNull(timer);
- this.qid = InstanceIdentifier.builder(InstructionsQueue.class).toInstance();
+ this.qid = InstanceIdentifier.builder(InstructionsQueue.class).build();
final ReadWriteTransaction t = dataProvider.newReadWriteTransaction();
try {
private boolean assertInstructionExists(final InstructionId id) {
try {
- return getDataBroker().newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(InstructionsQueue.class).toInstance().child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.instruction.queue.Instruction.class,
+ return getDataBroker().newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(InstructionsQueue.class).build().child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.instruction.queue.Instruction.class,
new InstructionKey(id))).get().isPresent();
} catch (InterruptedException | ExecutionException e) {
return false;