use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder in project netconf by opendaylight.
the class CapabilityChangeNotificationProducerTest method testOnDataChangedDelete.
@Test
public void testOnDataChangedDelete() {
final List<Uri> originalCapabilitiesList = Lists.newArrayList(new Uri("originalCapability"), new Uri("anotherOriginalCapability"));
final Capabilities originalCapabilities = new CapabilitiesBuilder().setCapability(originalCapabilitiesList).build();
verifyDataTreeChange(DataObjectModification.ModificationType.DELETE, originalCapabilities, null, changedCapabilitesFrom(Collections.emptyList(), originalCapabilitiesList));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder in project netconf by opendaylight.
the class MonitoringToMdsalWriterTest method testOnCapabilityChanged.
@Test
public void testOnCapabilityChanged() throws Exception {
final InstanceIdentifier<Capabilities> capabilitiesId = InstanceIdentifier.create(NetconfState.class).child(Capabilities.class);
writer.start();
final Capabilities capabilities = new CapabilitiesBuilder().build();
writer.onCapabilitiesChanged(capabilities);
InOrder inOrder = inOrder(writeTransaction);
inOrder.verify(writeTransaction).put(LogicalDatastoreType.OPERATIONAL, capabilitiesId, capabilities);
inOrder.verify(writeTransaction).commit();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder in project netconf by opendaylight.
the class NetconfCapabilityMonitoringServiceTest method testGetCapabilities.
@Test
public void testGetCapabilities() throws Exception {
List<Uri> exp = new ArrayList<>();
for (Capability capability : capabilities) {
exp.add(new Uri(capability.getCapabilityUri()));
}
// candidate and url capabilities are added by monitoring service automatically
exp.add(new Uri(URN_IETF_PARAMS_NETCONF_CAPABILITY_CANDIDATE_1_0));
exp.add(new Uri(URN_IETF_PARAMS_NETCONF_CAPABILITY_URL_1_0));
Capabilities expected = new CapabilitiesBuilder().setCapability(exp).build();
Capabilities actual = monitoringService.getCapabilities();
assertEquals(new HashSet<>(expected.getCapability()), new HashSet<>(actual.getCapability()));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder in project netconf by opendaylight.
the class ConcurrentClientsTest method createMockedMonitoringService.
public static NetconfMonitoringService createMockedMonitoringService() {
NetconfMonitoringService monitoring = mock(NetconfMonitoringService.class);
final SessionListener sessionListener = mock(SessionListener.class);
doNothing().when(sessionListener).onSessionUp(any(NetconfServerSession.class));
doNothing().when(sessionListener).onSessionDown(any(NetconfServerSession.class));
doNothing().when(sessionListener).onSessionEvent(any(SessionEvent.class));
doReturn((AutoCloseable) () -> {
}).when(monitoring).registerCapabilitiesListener(any(NetconfMonitoringService.CapabilitiesListener.class));
doReturn(sessionListener).when(monitoring).getSessionListener();
doReturn(new CapabilitiesBuilder().setCapability(Collections.emptyList()).build()).when(monitoring).getCapabilities();
return monitoring;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder in project netconf by opendaylight.
the class CapabilityChangeNotificationProducerTest method testOnDataChangedCreate.
@Test
public void testOnDataChangedCreate() {
final InstanceIdentifier<Capabilities> capabilitiesIdentifier = InstanceIdentifier.create(NetconfState.class).child(Capabilities.class);
final List<Uri> newCapabilitiesList = Lists.newArrayList(new Uri("newCapability"), new Uri("createdCapability"));
Capabilities newCapabilities = new CapabilitiesBuilder().setCapability(newCapabilitiesList).build();
Map<InstanceIdentifier<?>, DataObject> createdData = new HashMap<>();
createdData.put(capabilitiesIdentifier, newCapabilities);
verifyDataTreeChange(DataObjectModification.ModificationType.WRITE, null, newCapabilities, changedCapabilitesFrom(newCapabilitiesList, Collections.emptyList()));
}
Aggregations