@Test public void testAddBinding() throws Exception { assertEquals(0, database.addBinding(NodeId.getDefaultInstance("1.1.1.1"), mergeBindings()).size()); assertEquals(0, database.getBindings().size()); database.addBinding(NodeId.getDefaultInstance("10.10.10.10"), mergeBindings(getBinding("0.0.0.0/0", 5, "10.10.10.10"), getBinding("1.1.1.1/32", 10, "10.10.10.10"), getBinding("1.1.1.1/32", 100, "10.10.10.10"))); database.addBinding(NodeId.getDefaultInstance("20.20.20.20"), mergeBindings(getBinding("2.2.2.2/32", 20, "20.20.20.20", "10.10.10.10"), getBinding("2.2.2.2/32", 200, "20.20.20.20"))); assertBindings(database.getBindings(), mergeBindings(getBinding("1.1.1.1/32", 10, "10.10.10.10"), getBinding("1.1.1.1/32", 100, "10.10.10.10"), getBinding("2.2.2.2/32", 20, "20.20.20.20", "10.10.10.10"), getBinding("2.2.2.2/32", 200, "20.20.20.20"))); assertBindings(database.getBindings(NodeId.getDefaultInstance("10.10.10.10")), mergeBindings(getBinding("1.1.1.1/32", 10, "10.10.10.10"), getBinding("1.1.1.1/32", 100, "10.10.10.10"))); assertBindings(database.getBindings(NodeId.getDefaultInstance("20.20.20.20")), mergeBindings(getBinding("2.2.2.2/32", 20, "20.20.20.20", "10.10.10.10"), getBinding("2.2.2.2/32", 200, "20.20.20.20"))); }
@Override protected List<SxpDatabaseBinding> getBindings(BindingDatabase.BindingType bindingType) { BindingDatabase result = datastoreAccess.readSynchronous(getIdentifierBuilder(bindingType).build(), LogicalDatastoreType.OPERATIONAL); List<SxpDatabaseBinding> bindings = new ArrayList<>(); if (result != null && result.getBindingSources() != null && result.getBindingSources().getBindingSource() != null) { result.getBindingSources().getBindingSource().forEach(s -> { if (s.getSxpDatabaseBindings() != null && s.getSxpDatabaseBindings().getSxpDatabaseBinding() != null && !s.getSxpDatabaseBindings().getSxpDatabaseBinding().isEmpty()) { bindings.addAll(s.getSxpDatabaseBindings().getSxpDatabaseBinding()); } }); } return bindings; }
SxpDatastoreImpl extends org.opendaylight.sxp.util.database.SxpDatabase { @Override protected List<SxpDatabaseBinding> getBindings(BindingDatabase.BindingType bindingType) { BindingDatabase result = datastoreAccess.readSynchronous(getIdentifierBuilder(bindingType).build(), LogicalDatastoreType.OPERATIONAL); List<SxpDatabaseBinding> bindings = new ArrayList<>(); if (result != null && result.getBindingSources() != null && result.getBindingSources().getBindingSource() != null) { result.getBindingSources().getBindingSource().forEach(s -> { if (s.getSxpDatabaseBindings() != null && s.getSxpDatabaseBindings().getSxpDatabaseBinding() != null && !s.getSxpDatabaseBindings().getSxpDatabaseBinding().isEmpty()) { bindings.addAll(s.getSxpDatabaseBindings().getSxpDatabaseBinding()); } }); } return bindings; } }
SxpDatastoreImpl extends org.opendaylight.sxp.util.database.SxpDatabase { @Override protected List<SxpDatabaseBinding> getBindings(BindingDatabase.BindingType bindingType) { BindingDatabase result = datastoreAccess.readSynchronous(getIdentifierBuilder(bindingType).build(), LogicalDatastoreType.OPERATIONAL); List<SxpDatabaseBinding> bindings = new ArrayList<>(); if (result != null && result.getBindingSources() != null && result.getBindingSources().getBindingSource() != null) { result.getBindingSources().getBindingSource().forEach(s -> { if (s.getSxpDatabaseBindings() != null && s.getSxpDatabaseBindings().getSxpDatabaseBinding() != null && !s.getSxpDatabaseBindings().getSxpDatabaseBinding().isEmpty()) { bindings.addAll(s.getSxpDatabaseBindings().getSxpDatabaseBinding()); } }); } return bindings; } SxpDatastoreImpl(DatastoreAccess datastoreAccess, String nodeId, String domain); }
SxpDatastoreImpl extends org.opendaylight.sxp.util.database.SxpDatabase { @Override protected List<SxpDatabaseBinding> getBindings(BindingDatabase.BindingType bindingType) { BindingDatabase result = datastoreAccess.readSynchronous(getIdentifierBuilder(bindingType).build(), LogicalDatastoreType.OPERATIONAL); List<SxpDatabaseBinding> bindings = new ArrayList<>(); if (result != null && result.getBindingSources() != null && result.getBindingSources().getBindingSource() != null) { result.getBindingSources().getBindingSource().forEach(s -> { if (s.getSxpDatabaseBindings() != null && s.getSxpDatabaseBindings().getSxpDatabaseBinding() != null && !s.getSxpDatabaseBindings().getSxpDatabaseBinding().isEmpty()) { bindings.addAll(s.getSxpDatabaseBindings().getSxpDatabaseBinding()); } }); } return bindings; } SxpDatastoreImpl(DatastoreAccess datastoreAccess, String nodeId, String domain); DatastoreAccess getDatastoreAccess(); @Override void close(); }
SxpDatastoreImpl extends org.opendaylight.sxp.util.database.SxpDatabase { @Override protected List<SxpDatabaseBinding> getBindings(BindingDatabase.BindingType bindingType) { BindingDatabase result = datastoreAccess.readSynchronous(getIdentifierBuilder(bindingType).build(), LogicalDatastoreType.OPERATIONAL); List<SxpDatabaseBinding> bindings = new ArrayList<>(); if (result != null && result.getBindingSources() != null && result.getBindingSources().getBindingSource() != null) { result.getBindingSources().getBindingSource().forEach(s -> { if (s.getSxpDatabaseBindings() != null && s.getSxpDatabaseBindings().getSxpDatabaseBinding() != null && !s.getSxpDatabaseBindings().getSxpDatabaseBinding().isEmpty()) { bindings.addAll(s.getSxpDatabaseBindings().getSxpDatabaseBinding()); } }); } return bindings; } SxpDatastoreImpl(DatastoreAccess datastoreAccess, String nodeId, String domain); DatastoreAccess getDatastoreAccess(); @Override void close();  }