From af0838981ce48bb1d004edd2a16a5eb22df0da74 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Thu, 25 Feb 2021 09:36:40 -0500 Subject: Update SDNC CSIT for Honolulu changes Added env settings needed to start up SDNC container, and updated URL used to retrieve list of APIs (which changes in OpenDaylight Aluminum). Removed unneeded code to start up cert service (since those certs are not needed for NETCONF/TLS ... the certs we need are for the NETCONF device itself). Commented out tests of TLS connection for now - simulator we had been using no longer exists (docker is no longer in nexus3.onap.org) and connection to new simulator is not yet working. Will restore those tests in a separate commit after debugging with new netconf simulator. Change-Id: I096694a3c70c92c951b7e50f73418ecb8c99d575 Issue-ID: SDNC-1473 Signed-off-by: Dan Timoney --- .../sdnc/netconf-pnp-simulator/docker-compose.yml | 12 -- .../netconf-pnp-simulator/netconf-config/data.json | 10 -- .../netconf-config/model.yang | 29 ----- .../netconf-config/subscriber.py | 136 --------------------- scripts/sdnc/sdnc/certs/keys0.zip | Bin 5057 -> 6006 bytes scripts/sdnc/sdnc/docker-compose.yml | 43 +++++-- 6 files changed, 34 insertions(+), 196 deletions(-) delete mode 100755 scripts/sdnc/netconf-pnp-simulator/docker-compose.yml delete mode 100644 scripts/sdnc/netconf-pnp-simulator/netconf-config/data.json delete mode 100644 scripts/sdnc/netconf-pnp-simulator/netconf-config/model.yang delete mode 100755 scripts/sdnc/netconf-pnp-simulator/netconf-config/subscriber.py (limited to 'scripts') diff --git a/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml b/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml deleted file mode 100755 index d8e723ba..00000000 --- a/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: '3' - -services: - netconf-pnp-simulator: - image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.6 - container_name: netconf-simulator - restart: always - ports: - - "830:830" - - "6513:6513" - volumes: - - ${NETCONF_CONFIG_PATH}:/config/modules/mynetconf diff --git a/scripts/sdnc/netconf-pnp-simulator/netconf-config/data.json b/scripts/sdnc/netconf-pnp-simulator/netconf-config/data.json deleted file mode 100644 index 63872eef..00000000 --- a/scripts/sdnc/netconf-pnp-simulator/netconf-config/data.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "mynetconf:netconflist": { - "netconf": [ - { - "netconf-id": 3, - "netconf-param": 3 - } - ] - } -} diff --git a/scripts/sdnc/netconf-pnp-simulator/netconf-config/model.yang b/scripts/sdnc/netconf-pnp-simulator/netconf-config/model.yang deleted file mode 100644 index 6c8c36ab..00000000 --- a/scripts/sdnc/netconf-pnp-simulator/netconf-config/model.yang +++ /dev/null @@ -1,29 +0,0 @@ -module mynetconf { - yang-version 1.1; - namespace "urn:mynetconf:test"; - - prefix nft; - - organization - "mynetconf"; - contact - "my netconf address"; - description - "yang model for mynetconf"; - revision "2019-03-01" { - description - "initial version"; - } - - container netconflist { - list netconf { - key netconf-id; - leaf netconf-id { - type uint16; - } - leaf netconf-param { - type uint32; - } - } - } -} diff --git a/scripts/sdnc/netconf-pnp-simulator/netconf-config/subscriber.py b/scripts/sdnc/netconf-pnp-simulator/netconf-config/subscriber.py deleted file mode 100755 index 61272967..00000000 --- a/scripts/sdnc/netconf-pnp-simulator/netconf-config/subscriber.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env python3 - -__author__ = "Mislav Novakovic " -__copyright__ = "Copyright 2018, Deutsche Telekom AG" -__license__ = "Apache 2.0" - -# 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. - -# This sample application demonstrates use of Python programming language bindings for sysrepo library. -# Original c application was rewritten in Python to show similarities and differences -# between the two. -# -# Most notable difference is in the very different nature of languages, c is weakly statically typed language -# while Python is strongly dynamically typed. Python code is much easier to read and logic easier to comprehend -# for smaller scripts. Memory safety is not an issue but lower performance can be expected. -# -# The original c implementation is also available in the source, so one can refer to it to evaluate trade-offs. - -import sysrepo as sr -import sys - - -# Helper function for printing changes given operation, old and new value. -def print_change(op, old_val, new_val): - if op == sr.SR_OP_CREATED: - print(f"CREATED: {new_val.to_string()}") - elif op == sr.SR_OP_DELETED: - print(f"DELETED: {old_val.to_string()}") - elif op == sr.SR_OP_MODIFIED: - print(f"MODIFIED: {old_val.to_string()} to {new_val.to_string()}") - elif op == sr.SR_OP_MOVED: - print(f"MOVED: {new_val.xpath()} after {old_val.xpath()}") - - -# Helper function for printing events. -def ev_to_str(ev): - if ev == sr.SR_EV_VERIFY: - return "verify" - elif ev == sr.SR_EV_APPLY: - return "apply" - elif ev == sr.SR_EV_ABORT: - return "abort" - else: - return "unknown" - - -# Function to print current configuration state. -# It does so by loading all the items of a session and printing them out. -def print_current_config(session, module_name): - select_xpath = f"/{module_name}:*//*" - - values = session.get_items(select_xpath) - - if values is not None: - print("========== BEGIN CONFIG ==========") - for i in range(values.val_cnt()): - print(values.val(i).to_string(), end='') - print("=========== END CONFIG ===========") - - -# Function to be called for subscribed client of given session whenever configuration changes. -def module_change_cb(sess, module_name, event, private_ctx): - try: - print("========== Notification " + ev_to_str(event) + " =============================================") - if event == sr.SR_EV_APPLY: - print_current_config(sess, module_name) - - print("========== CHANGES: =============================================") - - change_path = f"/{module_name}:*" - - it = sess.get_changes_iter(change_path) - - while True: - change = sess.get_change_next(it) - if change is None: - break - print_change(change.oper(), change.old_val(), change.new_val()) - - print("========== END OF CHANGES =======================================") - except Exception as e: - print(e) - - return sr.SR_ERR_OK - - -def main(): - # Notable difference between c implementation is using exception mechanism for open handling unexpected events. - # Here it is useful because `Connection`, `Session` and `Subscribe` could throw an exception. - try: - module_name = "ietf-interfaces" - if len(sys.argv) > 1: - module_name = sys.argv[1] - else: - print("\nYou can pass the module name to be subscribed as the first argument") - - print(f"Application will watch for changes in {module_name}") - - # connect to sysrepo - conn = sr.Connection(module_name) - - # start session - sess = sr.Session(conn) - - # subscribe for changes in running config */ - subscribe = sr.Subscribe(sess) - - subscribe.module_change_subscribe(module_name, module_change_cb) - - try: - print_current_config(sess, module_name) - except Exception as e: - print(e) - - print("========== STARTUP CONFIG APPLIED AS RUNNING ==========") - - sr.global_loop() - - print("Application exit requested, exiting.") - - except Exception as e: - print(e) - - -if __name__ == '__main__': - main() diff --git a/scripts/sdnc/sdnc/certs/keys0.zip b/scripts/sdnc/sdnc/certs/keys0.zip index 48b4d90a..6f7f756b 100644 Binary files a/scripts/sdnc/sdnc/certs/keys0.zip and b/scripts/sdnc/sdnc/certs/keys0.zip differ diff --git a/scripts/sdnc/sdnc/docker-compose.yml b/scripts/sdnc/sdnc/docker-compose.yml index c47fab50..61bf8b6e 100755 --- a/scripts/sdnc/sdnc/docker-compose.yml +++ b/scripts/sdnc/sdnc/docker-compose.yml @@ -9,7 +9,10 @@ services: volumes: - /etc/localtime:/etc/localtime:ro environment: - - MYSQL_ROOT_PASSWORD=password + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} hostname: mariadb.so.testlab.onap.org logging: @@ -29,12 +32,38 @@ services: - "8282:8181" hostname: sdnc + links: + - mariadb:dbhost + - mariadb:sdnctldb01 + - mariadb:sdnctldb02 environment: - - MYSQL_ROOT_PASSWORD=password + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties - - MYSQL_PASSWD=password - - ODL_ADMIN_USERNAME=admin - - ODL_ADMIN_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + - SDNC_BIN=/opt/onap/sdnc/bin + - ODL_CERT_DIR=/tmp + - ODL_ADMIN_USERNAME=${ODL_USER} + - ODL_ADMIN_PASSWORD=${ODL_PASSWORD} + - ODL_USER=${ODL_USER} + - ODL_PASSWORD=${ODL_PASSWORD} + - ODL_CERT_DIR=/opt/opendaylight/current/certs + - SDNC_DB_INIT=true + - HONEYCOMB_USER=${HONEYCOMB_USER} + - HONEYCOMB_PASSWORD=${HONEYCOMB_PASSWORD} + - TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD} + - KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD} + - SO_USER=${SO_USER} + - SO_PASSWORD=${SO_PASSWORD} + - NENG_USER=${NENG_USER} + - NENG_PASSWORD=${NENG_PASSWORD} + - CDS_USER=${CDS_USER} + - CDS_PASSWORD=${CDS_PASSWORD} + - ANSIBLE_USER=${ANSIBLE_USER} + - ANSIBLE_PASSWORD=${ANSIBLE_PASSWORD} + - SQL_CRYPTKEY=${SQL_CRYPTKEY} + - A1_TRUSTSTORE_PASSWORD=a1adapter depends_on: - mariadb dns: @@ -44,7 +73,3 @@ services: options: max-size: "30m" max-file: "5" - extra_hosts: - - sdnctldb02:${LOCAL_IP} - - sdnctldb01:${LOCAL_IP} - - dbhost:${LOCAL_IP} \ No newline at end of file -- cgit 1.2.3-korg