From d54e59419f5e58a0d99a0a09714f35fd317acd03 Mon Sep 17 00:00:00 2001 From: Illia Date: Mon, 15 Feb 2021 20:03:51 +0200 Subject: [PATCH] Add GSON models for device registration Intention is to use the PATCH method for node registration(no matter if that's a single node registration or multiple nodes). JIRA: NETCONF-758 Change-Id: Ia624cfe2f953f6f5dc7a4ebd0d7cfbb0c0185f1a Signed-off-by: Illia --- .../netconf/test/tool/model/Node.java | 99 +++++++++++++++++++ .../netconf/test/tool/model/Payload.java | 28 ++++++ .../netconf/test/tool/model/Topology.java | 47 +++++++++ 3 files changed, 174 insertions(+) create mode 100644 netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Node.java create mode 100644 netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Payload.java create mode 100644 netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Topology.java diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Node.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Node.java new file mode 100644 index 0000000000..76acc997ba --- /dev/null +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Node.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.netconf.test.tool.model; + +public class Node { + private String nodeId; + private String host; + private Integer port; + private String username; + private String password; + private Boolean tcpOnly; + private Integer keepaliveDelay; + private Boolean schemaless; + + public Node() { + + } + + public Node(final String nodeId, final String host, final Integer port, final String username, + final String password, final Boolean tcpOnly, final Integer keepaliveDelay, final Boolean schemaless) { + this.nodeId = nodeId; + this.host = host; + this.port = port; + this.username = username; + this.password = password; + this.tcpOnly = tcpOnly; + this.keepaliveDelay = keepaliveDelay; + this.schemaless = schemaless; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(final String nodeId) { + this.nodeId = nodeId; + } + + public String getUsername() { + return username; + } + + public void setUsername(final String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(final String password) { + this.password = password; + } + + public String getHost() { + return host; + } + + public void setHost(final String host) { + this.host = host; + } + + public Integer getKeepaliveDelay() { + return keepaliveDelay; + } + + public void setKeepaliveDelay(final Integer keepaliveDelay) { + this.keepaliveDelay = keepaliveDelay; + } + + public Integer getPort() { + return port; + } + + public void setPort(final Integer port) { + this.port = port; + } + + public Boolean getSchemaless() { + return schemaless; + } + + public void setSchemaless(final Boolean schemaless) { + this.schemaless = schemaless; + } + + public Boolean getTcpOnly() { + return tcpOnly; + } + + public void setTcpOnly(final Boolean tcpOnly) { + this.tcpOnly = tcpOnly; + } +} \ No newline at end of file diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Payload.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Payload.java new file mode 100644 index 0000000000..2bcf7add94 --- /dev/null +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Payload.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.netconf.test.tool.model; + +public class Payload { + private Topology topology; + + public Payload() { + + } + + public Payload(final Topology topology) { + this.topology = topology; + } + + public Topology getTopology() { + return topology; + } + + public void setTopology(Topology topology) { + this.topology = topology; + } +} diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Topology.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Topology.java new file mode 100644 index 0000000000..4fb1ee10ed --- /dev/null +++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/model/Topology.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.netconf.test.tool.model; + +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; + +public class Topology { + private String topologyId; + + @SerializedName("node") + private List nodeList = new ArrayList<>(); + + public Topology() { + + } + + public Topology(final String topologyId) { + this.topologyId = topologyId; + } + + public void addNode(final Node node) { + this.nodeList.add(node); + } + + public String getTopologyId() { + return topologyId; + } + + public void setTopologyId(String topologyId) { + this.topologyId = topologyId; + } + + public List getNodeList() { + return nodeList; + } + + public void setNodeList(List nodeList) { + this.nodeList = nodeList; + } +} -- 2.36.6