summaryrefslogtreecommitdiffstats
path: root/components/scripts/python/ccsdk_netconf
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2019-03-26 09:49:13 -0400
committerAlexis de Talhouët <adetalhouet89@gmail.com>2019-03-26 09:49:13 -0400
commit72d22a4339db09824d46746dacbba1e141763dc0 (patch)
tree7fbfea4b81afca0bc0c95e5d4b810f236f4dea29 /components/scripts/python/ccsdk_netconf
parentef6983b670796becfa66c69075c1829e8f9aef4b (diff)
Migrate ccdsk/apps to ccsdk/cds
Change-Id: I020a2ccec4e691717f888e8bd2afec91a7c4e987 Issue-ID: CCSDK-1178 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'components/scripts/python/ccsdk_netconf')
-rw-r--r--components/scripts/python/ccsdk_netconf/__init__.py0
-rw-r--r--components/scripts/python/ccsdk_netconf/common.py28
-rw-r--r--components/scripts/python/ccsdk_netconf/netconf_constant.py15
-rw-r--r--components/scripts/python/ccsdk_netconf/netconfclient.py62
4 files changed, 0 insertions, 105 deletions
diff --git a/components/scripts/python/ccsdk_netconf/__init__.py b/components/scripts/python/ccsdk_netconf/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/components/scripts/python/ccsdk_netconf/__init__.py
+++ /dev/null
diff --git a/components/scripts/python/ccsdk_netconf/common.py b/components/scripts/python/ccsdk_netconf/common.py
deleted file mode 100644
index f161e29f..00000000
--- a/components/scripts/python/ccsdk_netconf/common.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (c) 2019 Bell Canada.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-class ResolutionHelper:
-
- def __init__(self, component_function):
- self.component_function = component_function
-
- def resolve_and_generate_message_from_template_prefix(self, artifact_prefix):
- return self.component_function.resolveAndGenerateMessage(artifact_prefix)
-
- def resolve_and_generate_message(self, artifact_mapping, artifact_template):
- return self.component_function.resolveAndGenerateMessage(artifact_mapping,
- artifact_template)
-
- def retrieve_resolved_template_from_database(self, key, artifact_template):
- return self.component_function.resolveFromDatabase(key, artifact_template)
diff --git a/components/scripts/python/ccsdk_netconf/netconf_constant.py b/components/scripts/python/ccsdk_netconf/netconf_constant.py
deleted file mode 100644
index 534ca9e1..00000000
--- a/components/scripts/python/ccsdk_netconf/netconf_constant.py
+++ /dev/null
@@ -1,15 +0,0 @@
-SERVICE_LOG = "log"
-SERVICE_NETCONF = "netconfService"
-SERVICE_MESSAGE = "messageService"
-
-PARAM_REQUEST_ID = "requestId"
-PARAM_ACTION = "action"
-
-STATUS_SUCCESS = "success"
-STATUS_FAILURE = "failure"
-
-CONFIG_TARGET_RUNNING = "running"
-CONFIG_TARGET_CANDIDATE = "candidate"
-CONFIG_DEFAULT_OPERATION_MERGE = "merge"
-CONFIG_DEFAULT_OPERATION_REPLACE = "replace"
-CONFIG_DEFAULT_OPERATION_NONE = "none"
diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py
deleted file mode 100644
index e263ba8f..00000000
--- a/components/scripts/python/ccsdk_netconf/netconfclient.py
+++ /dev/null
@@ -1,62 +0,0 @@
-from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \
- CONFIG_DEFAULT_OPERATION_REPLACE
-
-
-class NetconfClient:
-
- def __init__(self, log, component_function, requirement_name):
- self.log = log
- self.component_function = component_function
- netconf_device = self.component_function.initializeNetconfConnection(
- requirement_name)
- self.netconf_rpc_client = netconf_device.netconfRpcService
- self.netconf_session = netconf_device.netconfSession
-
- def disconnect(self):
- self.netconf_session.disconnect()
- return
-
- def connect(self):
- self.netconf_session.connect()
- return
-
- def lock(self, config_target=CONFIG_TARGET_CANDIDATE):
- device_response = self.netconf_rpc_client.lock(config_target)
- return device_response
-
- def get_config(self, filter="", config_target=CONFIG_TARGET_RUNNING):
- device_response = self.netconf_rpc_client.getConfig(filter, config_target)
- return device_response
-
- def edit_config(self, message_content, config_target=CONFIG_TARGET_CANDIDATE,
- edit_default_peration=CONFIG_DEFAULT_OPERATION_REPLACE):
- device_response = self.netconf_rpc_client.editConfig(message_content,
- config_target,
- edit_default_peration)
- return device_response
-
- def commit(self, confirmed=False, confirm_timeout=60, persist="",
- persist_id=""):
- device_response = self.netconf_rpc_client.commit(confirmed, confirm_timeout,
- persist, persist_id)
- return device_response
-
- def invoke_rpc(self, rpc):
- device_response = self.netconf_rpc_client.invokeRpc(rpc)
- return device_response
-
- def cancel_commit(self, persist_id=""):
- device_response = self.netconf_rpc_client.cancelCommit(persist_id)
- return device_response
-
- def unlock(self, config_target=CONFIG_TARGET_CANDIDATE):
- device_response = self.netconf_rpc_client.unLock(config_target)
- return device_response
-
- def validate(self, config_target=CONFIG_TARGET_CANDIDATE):
- device_response = self.netconf_rpc_client.validate(config_target)
- return device_response
-
- def discard_change(self):
- device_response = self.netconf_rpc_client.discardConfig()
- return device_response