@Test
  public void testIdRef() throws Exception {
    Preconditions.checkNotNull(broker, "Controller not initialized");

    NioEventLoopGroup nettyThreadgroup = new NioEventLoopGroup();
    NetconfClientDispatcher clientDispatcher =
        new NetconfClientDispatcher(
            nettyThreadgroup, nettyThreadgroup, CLIENT_CONNECTION_TIMEOUT_MILLIS);

    NetconfMessage edit = xmlFileToNetconfMessage("netconfMessages/editConfig_identities.xml");
    NetconfMessage commit = xmlFileToNetconfMessage("netconfMessages/commit.xml");
    NetconfMessage getConfig = xmlFileToNetconfMessage("netconfMessages/getConfig.xml");

    try (TestingNetconfClient netconfClient =
        new TestingNetconfClient(
            "client", tcpAddress, CLIENT_CONNECTION_TIMEOUT_MILLIS, clientDispatcher)) {
      sendMessage(edit, netconfClient);
      sendMessage(commit, netconfClient);
      sendMessage(
          getConfig,
          netconfClient,
          "id-test",
          "<prefix:afi xmlns:prefix=\"urn:opendaylight:params:xml:ns:yang:controller:config:test:types\">prefix:test-identity1</prefix:afi>",
          "<prefix:afi xmlns:prefix=\"urn:opendaylight:params:xml:ns:yang:controller:config:test:types\">prefix:test-identity2</prefix:afi>",
          "<prefix:safi xmlns:prefix=\"urn:opendaylight:params:xml:ns:yang:controller:config:test:types\">prefix:test-identity2</prefix:safi>",
          "<prefix:safi xmlns:prefix=\"urn:opendaylight:params:xml:ns:yang:controller:config:test:types\">prefix:test-identity1</prefix:safi>");

      clientDispatcher.close();
    } catch (Exception e) {
      fail(Throwables.getStackTraceAsString(e));
    }
  }
Ejemplo n.º 2
0
 public void initializeRemoteConnection(
     final NetconfClientDispatcher dispatch, final NetconfClientConfiguration config) {
   if (config instanceof NetconfReconnectingClientConfiguration) {
     dispatch.createReconnectingClient((NetconfReconnectingClientConfiguration) config);
   } else {
     dispatch.createClient(config);
   }
 }