diff options
Diffstat (limited to 'test/mocks/pnfsimulator/netopeer_tls_cfg')
5 files changed, 100 insertions, 0 deletions
diff --git a/test/mocks/pnfsimulator/netopeer_tls_cfg/building.data b/test/mocks/pnfsimulator/netopeer_tls_cfg/building.data new file mode 100644 index 000000000..42e811b2c --- /dev/null +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/building.data @@ -0,0 +1,10 @@ +{ + "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 new file mode 100644 index 000000000..9afe9721e --- /dev/null +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/building.yang @@ -0,0 +1,26 @@ +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/test_server_key.pem b/test/mocks/pnfsimulator/netopeer_tls_cfg/test_server_key.pem new file mode 100644 index 000000000..d61c77bdf --- /dev/null +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/test_server_key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAsdI1TBjzX1PgQXFuPCw5/kQwU7qkrhirMcFAXhI8EoXepPa9 +fKAVuMjHW32P6nNzDpnhFe0YGdNloIEN3hJJ87cVOqj4o7zZMbq3zVG2L8As7MTA +8tYXm2fSC/0rIxxRRemcGUXM0q+4LEACjZj2pOKonaivF5VbhgNjPCO1Jj/TamUc +0aViE577C9L9EiObGM+bGbabWk/KWKLsvxUc+sKZXaJ7psTVgpggJAkUszlmwOQg +FiMSR53E9/CAkQYhzGVCmH44Vs6Hzs3RZjOTbce4wr4ongiA5LbPeSNSCFjy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Xl293Z3JonIWETUoE93EFz+qHdWg+rETtb +ZuqiAQKBgD+HI/syLECyO8UynuEaDD7qPl87PJ/CmZLMxa2/ZZUjhaXAW7CJMaS6 +9PIzsLk33y3O4Qer0wx/tEdfnxMTBJrgGt/lFFdAKhSJroZ45l5apiavg1oZYp89 +jSd0lVxWSmrBjBZLnqOl336gzaBVkBD5ND+XUPdR1UuVQExJlem4 +-----END RSA PRIVATE KEY----- diff --git a/test/mocks/pnfsimulator/netopeer_tls_cfg/test_server_key.pem.pub b/test/mocks/pnfsimulator/netopeer_tls_cfg/test_server_key.pem.pub new file mode 100644 index 000000000..9ccec4a0c --- /dev/null +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/test_server_key.pem.pub @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsdI1TBjzX1PgQXFuPCw5 +/kQwU7qkrhirMcFAXhI8EoXepPa9fKAVuMjHW32P6nNzDpnhFe0YGdNloIEN3hJJ +87cVOqj4o7zZMbq3zVG2L8As7MTA8tYXm2fSC/0rIxxRRemcGUXM0q+4LEACjZj2 +pOKonaivF5VbhgNjPCO1Jj/TamUc0aViE577C9L9EiObGM+bGbabWk/KWKLsvxUc ++sKZXaJ7psTVgpggJAkUszlmwOQgFiMSR53E9/CAkQYhzGVCmH44Vs6Hzs3RZjOT +bce4wr4ongiA5LbPeSNSCFjy9loKpaE1rtOjkNBVdiNPCQTmLuODXUTKgkeL+9v/ +OwIDAQAB +-----END PUBLIC KEY----- diff --git a/test/mocks/pnfsimulator/netopeer_tls_cfg/update_tls.sh b/test/mocks/pnfsimulator/netopeer_tls_cfg/update_tls.sh new file mode 100755 index 000000000..30be458c6 --- /dev/null +++ b/test/mocks/pnfsimulator/netopeer_tls_cfg/update_tls.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NETOPEER_CONFIG_PATH='/opt/dev/Netopeer2/server/configuration' +MOUNT_PATH='/netopeer_tls_cfg' +KEY_PATH='/usr/local/etc/keystored/keys' +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 +} + +# This function configures server/trusted certificates into Netopeer +configure_tls() +{ + sed -i "s/>test</>netconf</g" $NETOPEER_CONFIG_PATH/tls_listen.xml + sysrepocfg --datastore=running --format=xml ietf-keystore --merge=$NETOPEER_CONFIG_PATH/load_server_certs.xml + sysrepocfg --datastore=running --format=xml ietf-netconf-server --merge=$NETOPEER_CONFIG_PATH/tls_listen.xml +} + +cp $MOUNT_PATH/test_server_key.pem $KEY_PATH +cp $MOUNT_PATH/test_server_key.pem.pub $KEY_PATH +configure_tls +upload_yang_data_model + |