From b4db7778d204a434604330e6a63a6f2fc8d8f84b Mon Sep 17 00:00:00 2001 From: Rahul Tyagi Date: Fri, 1 Mar 2019 03:14:46 +0000 Subject: INT-885: fix netopeer and update yang model This commit introdues a better yang model for testing i.e. mynetconf.yang and data against it. It also fix a problem for netopeer at startup. Issue-ID: INT-885 Change-Id: I1d300221399237e57e1ffd4e3a1d9cb8e1674b44 Signed-off-by: Rahul Tyagi --- test/mocks/pnfsimulator/docker-compose.yml | 2 +- .../pnfsimulator/netopeer_tls_cfg/building.data | 10 --------- .../pnfsimulator/netopeer_tls_cfg/building.yang | 26 ---------------------- .../pnfsimulator/netopeer_tls_cfg/entrypoint.sh | 2 ++ .../pnfsimulator/netopeer_tls_cfg/mynetconf.data | 10 +++++++++ .../pnfsimulator/netopeer_tls_cfg/mynetconf.yang | 26 ++++++++++++++++++++++ .../pnfsimulator/netopeer_tls_cfg/update_tls.sh | 8 +++---- 7 files changed, 43 insertions(+), 41 deletions(-) delete mode 100644 test/mocks/pnfsimulator/netopeer_tls_cfg/building.data delete mode 100644 test/mocks/pnfsimulator/netopeer_tls_cfg/building.yang create mode 100755 test/mocks/pnfsimulator/netopeer_tls_cfg/entrypoint.sh create mode 100644 test/mocks/pnfsimulator/netopeer_tls_cfg/mynetconf.data create mode 100644 test/mocks/pnfsimulator/netopeer_tls_cfg/mynetconf.yang diff --git a/test/mocks/pnfsimulator/docker-compose.yml b/test/mocks/pnfsimulator/docker-compose.yml index 0a0860d0f..bbb983fd4 100644 --- a/test/mocks/pnfsimulator/docker-compose.yml +++ b/test/mocks/pnfsimulator/docker-compose.yml @@ -31,7 +31,7 @@ services: - sftp-server - ftpes-server-pure-ftpd - ftpes-server-vsftpd - command: bash -c "/netopeer_tls_cfg/update_tls.sh" + command: bash -c "/netopeer_tls_cfg/entrypoint.sh" sftp-server: container_name: sftp-server diff --git a/test/mocks/pnfsimulator/netopeer_tls_cfg/building.data b/test/mocks/pnfsimulator/netopeer_tls_cfg/building.data deleted file mode 100644 index 42e811b2c..000000000 --- a/test/mocks/pnfsimulator/netopeer_tls_cfg/building.data +++ /dev/null @@ -1,10 +0,0 @@ -{ - "building:rooms": { - "room": [ - { - "room-number": 3, - "size": 3 - } - ] - } -} diff --git a/test/mocks/pnfsimulator/netopeer_tls_cfg/building.yang b/test/mocks/pnfsimulator/netopeer_tls_cfg/building.yang deleted file mode 100644 index 9afe9721e..000000000 --- a/test/mocks/pnfsimulator/netopeer_tls_cfg/building.yang +++ /dev/null @@ -1,26 +0,0 @@ -module building { - yang-version 1.1; - namespace "urn:building:test"; - - prefix bld; - - organization "building"; - contact "my buildig address"; - description "yang model for building"; - revision "2018-02-13"{ - description "initial version"; - } - - container rooms{ - list room{ - key room-number; - leaf room-number{ - type uint16; - } - leaf size { - type uint32; - } - } - - } -} diff --git a/test/mocks/pnfsimulator/netopeer_tls_cfg/entrypoint.sh b/test/mocks/pnfsimulator/netopeer_tls_cfg/entrypoint.sh new file mode 100755 index 000000000..45b30a1a1 --- /dev/null +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/entrypoint.sh @@ -0,0 +1,2 @@ +nohup /netopeer_tls_cfg/update_tls.sh & +exec /usr/bin/supervisord -c "/etc/supervisord.conf" diff --git a/test/mocks/pnfsimulator/netopeer_tls_cfg/mynetconf.data b/test/mocks/pnfsimulator/netopeer_tls_cfg/mynetconf.data new file mode 100644 index 000000000..63872eef9 --- /dev/null +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/mynetconf.data @@ -0,0 +1,10 @@ +{ + "mynetconf:netconflist": { + "netconf": [ + { + "netconf-id": 3, + "netconf-param": 3 + } + ] + } +} diff --git a/test/mocks/pnfsimulator/netopeer_tls_cfg/mynetconf.yang b/test/mocks/pnfsimulator/netopeer_tls_cfg/mynetconf.yang new file mode 100644 index 000000000..a0c094b40 --- /dev/null +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/mynetconf.yang @@ -0,0 +1,26 @@ +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/test/mocks/pnfsimulator/netopeer_tls_cfg/update_tls.sh b/test/mocks/pnfsimulator/netopeer_tls_cfg/update_tls.sh index 30be458c6..4091bea7d 100755 --- a/test/mocks/pnfsimulator/netopeer_tls_cfg/update_tls.sh +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/update_tls.sh @@ -1,5 +1,5 @@ #!/bin/bash - +sleep 20 NETOPEER_CONFIG_PATH='/opt/dev/Netopeer2/server/configuration' MOUNT_PATH='/netopeer_tls_cfg' KEY_PATH='/usr/local/etc/keystored/keys' @@ -8,9 +8,9 @@ SUBSCRIBE_APP_PATH='/opt/dev/sysrepo/build/examples/application_changes_example' # This function uploads test_data and model into netopeer2 server upload_yang_data_model() { - sysrepoctl -i -g $MOUNT_PATH/building.yang - $SUBSCRIBE_APP_PATH building > /dev/null & - sysrepocfg --datastore=running --format=json building --import=$MOUNT_PATH/building.data + sysrepoctl -i -g $MOUNT_PATH/mynetconf.yang + $SUBSCRIBE_APP_PATH mynetconf > /dev/null & + sysrepocfg --datastore=running --format=json mynetconf --import=$MOUNT_PATH/mynetconf.data } # This function configures server/trusted certificates into Netopeer -- cgit 1.2.3-korg