Search in sources :

Example 1 with CapabilitiesBuilder

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));
}
Also used : Capabilities(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities) CapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri) Test(org.junit.Test)

Example 2 with CapabilitiesBuilder

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();
}
Also used : InOrder(org.mockito.InOrder) Capabilities(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities) CapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder) NetconfState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState) Test(org.junit.Test)

Example 3 with CapabilitiesBuilder

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()));
}
Also used : Capability(org.opendaylight.netconf.api.capability.Capability) BasicCapability(org.opendaylight.netconf.api.capability.BasicCapability) YangModuleCapability(org.opendaylight.netconf.api.capability.YangModuleCapability) Capabilities(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities) CapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder) ArrayList(java.util.ArrayList) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri) Test(org.junit.Test)

Example 4 with CapabilitiesBuilder

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;
}
Also used : NetconfMonitoringService(org.opendaylight.netconf.api.monitoring.NetconfMonitoringService) SessionEvent(org.opendaylight.netconf.api.monitoring.SessionEvent) CapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder) SimpleNetconfClientSessionListener(org.opendaylight.netconf.client.SimpleNetconfClientSessionListener) SessionListener(org.opendaylight.netconf.api.monitoring.SessionListener)

Example 5 with CapabilitiesBuilder

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()));
}
Also used : DataObject(org.opendaylight.yangtools.yang.binding.DataObject) HashMap(java.util.HashMap) Capabilities(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities) CapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri) NetconfState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState) Test(org.junit.Test)

Aggregations

CapabilitiesBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder)6 Test (org.junit.Test)5 Capabilities (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities)5 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)4 NetconfState (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 InOrder (org.mockito.InOrder)1 BasicCapability (org.opendaylight.netconf.api.capability.BasicCapability)1 Capability (org.opendaylight.netconf.api.capability.Capability)1 YangModuleCapability (org.opendaylight.netconf.api.capability.YangModuleCapability)1 NetconfMonitoringService (org.opendaylight.netconf.api.monitoring.NetconfMonitoringService)1 SessionEvent (org.opendaylight.netconf.api.monitoring.SessionEvent)1 SessionListener (org.opendaylight.netconf.api.monitoring.SessionListener)1 SimpleNetconfClientSessionListener (org.opendaylight.netconf.client.SimpleNetconfClientSessionListener)1 DataObject (org.opendaylight.yangtools.yang.binding.DataObject)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1