From e179c810a2eaf76b0df91c9c48eb76954b33cdbd Mon Sep 17 00:00:00 2001 From: Sean Condon Date: Wed, 29 May 2019 18:30:51 +0100 Subject: [PATCH] Added in configs to suit the device simulators running on K8S --- configs/changeStore-sample.json | 53 ++++++++- configs/configStore-sample.json | 102 ++++++++++++++++++ .../files/configs/changeStore-sample.json | 53 ++++++++- .../files/configs/configStore-sample.json | 102 ++++++++++++++++++ .../files/configs/deviceStore-sample.json | 12 +-- pkg/northbound/gnmi/get_test.go | 4 +- 6 files changed, 310 insertions(+), 16 deletions(-) diff --git a/configs/changeStore-sample.json b/configs/changeStore-sample.json index 0d9c217f7..08729e40a 100644 --- a/configs/changeStore-sample.json +++ b/configs/changeStore-sample.json @@ -124,7 +124,7 @@ "ID": "4cQNf/bxKWdRO0h5GG4a58q5YEQ=", "Description": "Original configuration for devicesim", "Created": "2019-05-21T08:43:01Z", - "Config" : [ + "Config": [ { "Path": "/openconfig-interfaces:interfaces/interface[name=admin]/config/name", "Value": "admin" @@ -211,7 +211,7 @@ "ID": "i86kLjjNFr5IBa+O3YTuv9HBqJg=", "Description": "Modification of device sim 1", "Created": "2019-05-21T08:43:02Z", - "Config" : [ + "Config": [ { "Path": "/openconfig-system:system/config/hostname", "Value": "localhost:10161" @@ -226,7 +226,7 @@ "ID": "UyPwBSOxDqQM/ZCohHFannSF5ME=", "Description": "Modification of device sim 2", "Created": "2019-05-21T08:43:03Z", - "Config" : [ + "Config": [ { "Path": "/openconfig-system:system/config/hostname", "Value": "localhost:10162" @@ -241,7 +241,7 @@ "ID": "5FTJ5QDC0y/RoFnJPfdh8NsB+4Y=", "Description": "Modification of device sim 3", "Created": "2019-05-21T08:43:04Z", - "Config" : [ + "Config": [ { "Path": "/openconfig-system:system/config/hostname", "Value": "localhost:10163" @@ -251,6 +251,51 @@ "Value": "Welcome to gNMI service on localhost:10163" } ] + }, + "ZOBFNpGhCHoc9gLiJduqY1FiTzs=": { + "ID": "ZOBFNpGhCHoc9gLiJduqY1FiTzs=", + "Description": "Modification of device-1-device-simulator", + "Created": "2019-05-30T18:03:17Z", + "Config": [ + { + "Path": "/openconfig-system:system/config/hostname", + "Value": "device-1-device-simulator" + }, + { + "Path": "/openconfig-system:system/config/motd-banner", + "Value": "Welcome to gNMI service on device-1-device-simulator" + } + ] + }, + "ZYNxDoardxYaQwMtbFbf1qO9AjE=": { + "ID": "ZYNxDoardxYaQwMtbFbf1qO9AjE=", + "Description": "Modification of device-2-device-simulator", + "Created": "2019-05-30T18:03:17Z", + "Config": [ + { + "Path": "/openconfig-system:system/config/hostname", + "Value": "device-2-device-simulator" + }, + { + "Path": "/openconfig-system:system/config/motd-banner", + "Value": "Welcome to gNMI service on device-2-device-simulator" + } + ] + }, + "pLAjo6M3icVnLsZ8ZOjSaELH8SQ=": { + "ID": "pLAjo6M3icVnLsZ8ZOjSaELH8SQ=", + "Description": "Modification of device-3-device-simulator", + "Created": "2019-05-30T18:03:17Z", + "Config": [ + { + "Path": "/openconfig-system:system/config/hostname", + "Value": "device-3-device-simulator" + }, + { + "Path": "/openconfig-system:system/config/motd-banner", + "Value": "Welcome to gNMI service on device-3-device-simulator" + } + ] } } } diff --git a/configs/configStore-sample.json b/configs/configStore-sample.json index 42f5bf352..65f977a1a 100644 --- a/configs/configStore-sample.json +++ b/configs/configStore-sample.json @@ -161,6 +161,108 @@ "Organisation": "OpenConfig working group" } ] + }, + "device-1-device-simulator-1.0.0": { + "Name": "device-1-device-simulator-1.0.0", + "Device": "device-1-device-simulator", + "Version": "1.0.0", + "Type": "Devicesim", + "Created": "2019-05-30T18:03:17Z", + "Updated": "2019-05-30T18:03:17Z", + "Changes": [ + "4cQNf/bxKWdRO0h5GG4a58q5YEQ=", + "ZOBFNpGhCHoc9gLiJduqY1FiTzs=" + ], + "Models": [ + { + "Name": "openconfig-interfaces", + "Version": "2.0.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-openflow", + "Version": "0.1.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-platform", + "Version": "0.5.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-system", + "Version": "0.2.0", + "Organisation": "OpenConfig working group" + } + ] + }, + "device-2-device-simulator-1.0.0": { + "Name": "device-2-device-simulator-1.0.0", + "Device": "device-2-device-simulator", + "Version": "1.0.0", + "Type": "Devicesim", + "Created": "2019-05-30T18:03:17Z", + "Updated": "2019-05-30T18:03:17Z", + "Changes": [ + "4cQNf/bxKWdRO0h5GG4a58q5YEQ=", + "ZYNxDoardxYaQwMtbFbf1qO9AjE=" + ], + "Models": [ + { + "Name": "openconfig-interfaces", + "Version": "2.0.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-openflow", + "Version": "0.1.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-platform", + "Version": "0.5.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-system", + "Version": "0.2.0", + "Organisation": "OpenConfig working group" + } + ] + }, + "device-3-device-simulator-1.0.0": { + "Name": "device-3-device-simulator-1.0.0", + "Device": "device-3-device-simulator", + "Version": "1.0.0", + "Type": "Devicesim", + "Created": "2019-05-30T18:03:17Z", + "Updated": "2019-05-30T18:03:17Z", + "Changes": [ + "4cQNf/bxKWdRO0h5GG4a58q5YEQ=", + "pLAjo6M3icVnLsZ8ZOjSaELH8SQ=" + ], + "Models": [ + { + "Name": "openconfig-interfaces", + "Version": "2.0.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-openflow", + "Version": "0.1.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-platform", + "Version": "0.5.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-system", + "Version": "0.2.0", + "Organisation": "OpenConfig working group" + } + ] } } } diff --git a/deployments/helm/onos-config/files/configs/changeStore-sample.json b/deployments/helm/onos-config/files/configs/changeStore-sample.json index 0d9c217f7..08729e40a 100644 --- a/deployments/helm/onos-config/files/configs/changeStore-sample.json +++ b/deployments/helm/onos-config/files/configs/changeStore-sample.json @@ -124,7 +124,7 @@ "ID": "4cQNf/bxKWdRO0h5GG4a58q5YEQ=", "Description": "Original configuration for devicesim", "Created": "2019-05-21T08:43:01Z", - "Config" : [ + "Config": [ { "Path": "/openconfig-interfaces:interfaces/interface[name=admin]/config/name", "Value": "admin" @@ -211,7 +211,7 @@ "ID": "i86kLjjNFr5IBa+O3YTuv9HBqJg=", "Description": "Modification of device sim 1", "Created": "2019-05-21T08:43:02Z", - "Config" : [ + "Config": [ { "Path": "/openconfig-system:system/config/hostname", "Value": "localhost:10161" @@ -226,7 +226,7 @@ "ID": "UyPwBSOxDqQM/ZCohHFannSF5ME=", "Description": "Modification of device sim 2", "Created": "2019-05-21T08:43:03Z", - "Config" : [ + "Config": [ { "Path": "/openconfig-system:system/config/hostname", "Value": "localhost:10162" @@ -241,7 +241,7 @@ "ID": "5FTJ5QDC0y/RoFnJPfdh8NsB+4Y=", "Description": "Modification of device sim 3", "Created": "2019-05-21T08:43:04Z", - "Config" : [ + "Config": [ { "Path": "/openconfig-system:system/config/hostname", "Value": "localhost:10163" @@ -251,6 +251,51 @@ "Value": "Welcome to gNMI service on localhost:10163" } ] + }, + "ZOBFNpGhCHoc9gLiJduqY1FiTzs=": { + "ID": "ZOBFNpGhCHoc9gLiJduqY1FiTzs=", + "Description": "Modification of device-1-device-simulator", + "Created": "2019-05-30T18:03:17Z", + "Config": [ + { + "Path": "/openconfig-system:system/config/hostname", + "Value": "device-1-device-simulator" + }, + { + "Path": "/openconfig-system:system/config/motd-banner", + "Value": "Welcome to gNMI service on device-1-device-simulator" + } + ] + }, + "ZYNxDoardxYaQwMtbFbf1qO9AjE=": { + "ID": "ZYNxDoardxYaQwMtbFbf1qO9AjE=", + "Description": "Modification of device-2-device-simulator", + "Created": "2019-05-30T18:03:17Z", + "Config": [ + { + "Path": "/openconfig-system:system/config/hostname", + "Value": "device-2-device-simulator" + }, + { + "Path": "/openconfig-system:system/config/motd-banner", + "Value": "Welcome to gNMI service on device-2-device-simulator" + } + ] + }, + "pLAjo6M3icVnLsZ8ZOjSaELH8SQ=": { + "ID": "pLAjo6M3icVnLsZ8ZOjSaELH8SQ=", + "Description": "Modification of device-3-device-simulator", + "Created": "2019-05-30T18:03:17Z", + "Config": [ + { + "Path": "/openconfig-system:system/config/hostname", + "Value": "device-3-device-simulator" + }, + { + "Path": "/openconfig-system:system/config/motd-banner", + "Value": "Welcome to gNMI service on device-3-device-simulator" + } + ] } } } diff --git a/deployments/helm/onos-config/files/configs/configStore-sample.json b/deployments/helm/onos-config/files/configs/configStore-sample.json index 42f5bf352..65f977a1a 100644 --- a/deployments/helm/onos-config/files/configs/configStore-sample.json +++ b/deployments/helm/onos-config/files/configs/configStore-sample.json @@ -161,6 +161,108 @@ "Organisation": "OpenConfig working group" } ] + }, + "device-1-device-simulator-1.0.0": { + "Name": "device-1-device-simulator-1.0.0", + "Device": "device-1-device-simulator", + "Version": "1.0.0", + "Type": "Devicesim", + "Created": "2019-05-30T18:03:17Z", + "Updated": "2019-05-30T18:03:17Z", + "Changes": [ + "4cQNf/bxKWdRO0h5GG4a58q5YEQ=", + "ZOBFNpGhCHoc9gLiJduqY1FiTzs=" + ], + "Models": [ + { + "Name": "openconfig-interfaces", + "Version": "2.0.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-openflow", + "Version": "0.1.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-platform", + "Version": "0.5.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-system", + "Version": "0.2.0", + "Organisation": "OpenConfig working group" + } + ] + }, + "device-2-device-simulator-1.0.0": { + "Name": "device-2-device-simulator-1.0.0", + "Device": "device-2-device-simulator", + "Version": "1.0.0", + "Type": "Devicesim", + "Created": "2019-05-30T18:03:17Z", + "Updated": "2019-05-30T18:03:17Z", + "Changes": [ + "4cQNf/bxKWdRO0h5GG4a58q5YEQ=", + "ZYNxDoardxYaQwMtbFbf1qO9AjE=" + ], + "Models": [ + { + "Name": "openconfig-interfaces", + "Version": "2.0.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-openflow", + "Version": "0.1.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-platform", + "Version": "0.5.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-system", + "Version": "0.2.0", + "Organisation": "OpenConfig working group" + } + ] + }, + "device-3-device-simulator-1.0.0": { + "Name": "device-3-device-simulator-1.0.0", + "Device": "device-3-device-simulator", + "Version": "1.0.0", + "Type": "Devicesim", + "Created": "2019-05-30T18:03:17Z", + "Updated": "2019-05-30T18:03:17Z", + "Changes": [ + "4cQNf/bxKWdRO0h5GG4a58q5YEQ=", + "pLAjo6M3icVnLsZ8ZOjSaELH8SQ=" + ], + "Models": [ + { + "Name": "openconfig-interfaces", + "Version": "2.0.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-openflow", + "Version": "0.1.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-platform", + "Version": "0.5.0", + "Organisation": "OpenConfig working group" + }, + { + "Name": "openconfig-system", + "Version": "0.2.0", + "Organisation": "OpenConfig working group" + } + ] } } } diff --git a/deployments/helm/onos-config/files/configs/deviceStore-sample.json b/deployments/helm/onos-config/files/configs/deviceStore-sample.json index 17386da58..3c2f527d5 100644 --- a/deployments/helm/onos-config/files/configs/deviceStore-sample.json +++ b/deployments/helm/onos-config/files/configs/deviceStore-sample.json @@ -2,18 +2,18 @@ "Version": "1.0.0", "Storetype": "device", "Store": { - "localhost:10161": { - "Addr": "localhost:10161", + "device-1-device-simulator": { + "Addr": "device-1-device-simulator:10161", "User": "devicesim", "Pwd": "notused", "Timeout": 10000000000 }, - "localhost:10162": { - "Addr": "localhost:10162", + "device-2-device-simulator": { + "Addr": "device-2-device-simulator:10161", "Timeout": 10000000000 }, - "localhost:10163": { - "Addr": "localhost:10163", + "device-3-device-simulator": { + "Addr": "device-3-device-simulator:10161", "Timeout": 10000000000 } } diff --git a/pkg/northbound/gnmi/get_test.go b/pkg/northbound/gnmi/get_test.go index 9ef36931c..4d9deffe5 100644 --- a/pkg/northbound/gnmi/get_test.go +++ b/pkg/northbound/gnmi/get_test.go @@ -97,7 +97,7 @@ func Test_getAllDevices(t *testing.T) { deviceListStr := utils.StrVal(result.Notification[0].Update[0].Val) assert.Equal(t, deviceListStr, - "[Device1 (1.0.0), Device2 (1.0.0), Device2 (2.0.0), localhost:10161 (1.0.0), localhost:10162 (1.0.0), localhost:10163 (1.0.0)]") + "[Device1 (1.0.0), Device2 (1.0.0), Device2 (2.0.0), device-1-device-simulator (1.0.0), device-2-device-simulator (1.0.0), device-3-device-simulator (1.0.0), localhost:10161 (1.0.0), localhost:10162 (1.0.0), localhost:10163 (1.0.0)]") } // Test_getalldevices is where a wildcard is used for target - path is ignored @@ -118,7 +118,7 @@ func Test_getAllDevicesInPrefix(t *testing.T) { deviceListStr := utils.StrVal(result.Notification[0].Update[0].Val) assert.Equal(t, deviceListStr, - "[Device1 (1.0.0), Device2 (1.0.0), Device2 (2.0.0), localhost:10161 (1.0.0), localhost:10162 (1.0.0), localhost:10163 (1.0.0)]", + "[Device1 (1.0.0), Device2 (1.0.0), Device2 (2.0.0), device-1-device-simulator (1.0.0), device-2-device-simulator (1.0.0), device-3-device-simulator (1.0.0), localhost:10161 (1.0.0), localhost:10162 (1.0.0), localhost:10163 (1.0.0)]", "Expected value") }