From 3d2bde4d0ceaebba5796305a7637a0638d5770ed Mon Sep 17 00:00:00 2001 From: Petr Fedchenkov Date: Sun, 23 Feb 2020 15:41:43 +0300 Subject: [PATCH 1/4] fixes --- tests/cfg.json | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/cfg.json b/tests/cfg.json index dd8c556..ad46ea9 100644 --- a/tests/cfg.json +++ b/tests/cfg.json @@ -84,17 +84,13 @@ "systemAdapterList": [ { "uplink": true, - "freeUplink": true, "name": "eth0", - "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d58", - "lowerLayerName": "eth0" + "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d58" }, { "uplink": true, - "freeUplink": true, "name": "eth1", - "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d59", - "lowerLayerName": "eth1" + "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d59" } ], "networkInstances": [ @@ -122,5 +118,7 @@ "ipType": 1, "instType": 2 } - ] + ], + "manufacturer": "ZedVirtualDevice", + "productName": "ZedVirtual-4G" } From 26c9ae2eeaf285db8e5de4ef92980b28a4f2fe5a Mon Sep 17 00:00:00 2001 From: Petr Fedchenkov Date: Sun, 23 Feb 2020 16:13:46 +0300 Subject: [PATCH 2/4] lisp --- tests/cfg.json | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/cfg.json b/tests/cfg.json index ad46ea9..2b6bbe5 100644 --- a/tests/cfg.json +++ b/tests/cfg.json @@ -119,6 +119,57 @@ "instType": 2 } ], + "lispInfo": { + "LispMapServers": [ + { + "NameOrIp": "zedcontrol.zededa.net", + "Credential": "zededa-lispers.net" + } + ], + "LispInstance": 1000, + "EID": "fd5b:8f21:c6b2:2c14:1d41:bd5f:bf40:d6c4", + "EIDHashLen": 120, + "ZedServers": [ + { + "HostName": "zedcontrol", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedlake", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedbobo", + "EID": [ + "fdd5:79bf:7261:d9df:aea1:c8d2:842d:b99b" + ] + }, + { + "HostName": "hikey02", + "EID": [ + "fdfd:ceef:cf85:7e40:6d4f:2181:ba06:e668" + ] + }, + { + "HostName": "hikey04", + "EID": [ + "fd12:df08:d686:602d:2145:f7cf:2382:1683" + ] + }, + { + "HostName": "hikey05", + "EID": [ + "fd81:abc5:7d7e:bcd7:40d9:df2c:be4b:600" + ] + } + ], + "EidAllocationPrefix": "/Q==", + "EidAllocationPrefixLen": 8 + }, "manufacturer": "ZedVirtualDevice", "productName": "ZedVirtual-4G" } From f1191d9d8e80dae57c45afbdfe461bc7097825e9 Mon Sep 17 00:00:00 2001 From: Petr Fedchenkov Date: Mon, 24 Feb 2020 00:12:30 +0300 Subject: [PATCH 3/4] lisp --- tests/cfg_run_rkt.json | 57 ++++++++++++++++++++++++++++++++++++++--- tests/cfg_run_xen.json | 57 ++++++++++++++++++++++++++++++++++++++--- tests/cfg_stop_rkt.json | 57 ++++++++++++++++++++++++++++++++++++++--- tests/cfg_stop_xen.json | 57 ++++++++++++++++++++++++++++++++++++++--- 4 files changed, 216 insertions(+), 12 deletions(-) diff --git a/tests/cfg_run_rkt.json b/tests/cfg_run_rkt.json index 7fe649f..af56b60 100644 --- a/tests/cfg_run_rkt.json +++ b/tests/cfg_run_rkt.json @@ -158,14 +158,12 @@ "systemAdapterList": [ { "uplink": true, - "freeUplink": true, "name": "eth0", "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d58", "lowerLayerName": "eth0" }, { "uplink": true, - "freeUplink": true, "name": "eth1", "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d59", "lowerLayerName": "eth1" @@ -196,5 +194,58 @@ "ipType": 1, "instType": 2 } - ] + ], + "lispInfo": { + "LispMapServers": [ + { + "NameOrIp": "zedcontrol.zededa.net", + "Credential": "zededa-lispers.net" + } + ], + "LispInstance": 1000, + "EID": "fd5b:8f21:c6b2:2c14:1d41:bd5f:bf40:d6c4", + "EIDHashLen": 120, + "ZedServers": [ + { + "HostName": "zedcontrol", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedlake", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedbobo", + "EID": [ + "fdd5:79bf:7261:d9df:aea1:c8d2:842d:b99b" + ] + }, + { + "HostName": "hikey02", + "EID": [ + "fdfd:ceef:cf85:7e40:6d4f:2181:ba06:e668" + ] + }, + { + "HostName": "hikey04", + "EID": [ + "fd12:df08:d686:602d:2145:f7cf:2382:1683" + ] + }, + { + "HostName": "hikey05", + "EID": [ + "fd81:abc5:7d7e:bcd7:40d9:df2c:be4b:600" + ] + } + ], + "EidAllocationPrefix": "/Q==", + "EidAllocationPrefixLen": 8 + }, + "manufacturer": "ZedVirtualDevice", + "productName": "ZedVirtual-4G" } diff --git a/tests/cfg_run_xen.json b/tests/cfg_run_xen.json index 6e7cd1b..dabc412 100644 --- a/tests/cfg_run_xen.json +++ b/tests/cfg_run_xen.json @@ -159,14 +159,12 @@ "systemAdapterList": [ { "uplink": true, - "freeUplink": true, "name": "eth0", "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d58", "lowerLayerName": "eth0" }, { "uplink": true, - "freeUplink": true, "name": "eth1", "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d59", "lowerLayerName": "eth1" @@ -197,5 +195,58 @@ "ipType": 1, "instType": 2 } - ] + ], + "lispInfo": { + "LispMapServers": [ + { + "NameOrIp": "zedcontrol.zededa.net", + "Credential": "zededa-lispers.net" + } + ], + "LispInstance": 1000, + "EID": "fd5b:8f21:c6b2:2c14:1d41:bd5f:bf40:d6c4", + "EIDHashLen": 120, + "ZedServers": [ + { + "HostName": "zedcontrol", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedlake", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedbobo", + "EID": [ + "fdd5:79bf:7261:d9df:aea1:c8d2:842d:b99b" + ] + }, + { + "HostName": "hikey02", + "EID": [ + "fdfd:ceef:cf85:7e40:6d4f:2181:ba06:e668" + ] + }, + { + "HostName": "hikey04", + "EID": [ + "fd12:df08:d686:602d:2145:f7cf:2382:1683" + ] + }, + { + "HostName": "hikey05", + "EID": [ + "fd81:abc5:7d7e:bcd7:40d9:df2c:be4b:600" + ] + } + ], + "EidAllocationPrefix": "/Q==", + "EidAllocationPrefixLen": 8 + }, + "manufacturer": "ZedVirtualDevice", + "productName": "ZedVirtual-4G" } diff --git a/tests/cfg_stop_rkt.json b/tests/cfg_stop_rkt.json index db536b9..88c30fd 100644 --- a/tests/cfg_stop_rkt.json +++ b/tests/cfg_stop_rkt.json @@ -158,14 +158,12 @@ "systemAdapterList": [ { "uplink": true, - "freeUplink": true, "name": "eth0", "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d58", "lowerLayerName": "eth0" }, { "uplink": true, - "freeUplink": true, "name": "eth1", "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d59", "lowerLayerName": "eth1" @@ -196,5 +194,58 @@ "ipType": 1, "instType": 2 } - ] + ], + "lispInfo": { + "LispMapServers": [ + { + "NameOrIp": "zedcontrol.zededa.net", + "Credential": "zededa-lispers.net" + } + ], + "LispInstance": 1000, + "EID": "fd5b:8f21:c6b2:2c14:1d41:bd5f:bf40:d6c4", + "EIDHashLen": 120, + "ZedServers": [ + { + "HostName": "zedcontrol", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedlake", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedbobo", + "EID": [ + "fdd5:79bf:7261:d9df:aea1:c8d2:842d:b99b" + ] + }, + { + "HostName": "hikey02", + "EID": [ + "fdfd:ceef:cf85:7e40:6d4f:2181:ba06:e668" + ] + }, + { + "HostName": "hikey04", + "EID": [ + "fd12:df08:d686:602d:2145:f7cf:2382:1683" + ] + }, + { + "HostName": "hikey05", + "EID": [ + "fd81:abc5:7d7e:bcd7:40d9:df2c:be4b:600" + ] + } + ], + "EidAllocationPrefix": "/Q==", + "EidAllocationPrefixLen": 8 + }, + "manufacturer": "ZedVirtualDevice", + "productName": "ZedVirtual-4G" } diff --git a/tests/cfg_stop_xen.json b/tests/cfg_stop_xen.json index 9057114..0078654 100644 --- a/tests/cfg_stop_xen.json +++ b/tests/cfg_stop_xen.json @@ -159,14 +159,12 @@ "systemAdapterList": [ { "uplink": true, - "freeUplink": true, "name": "eth0", "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d58", "lowerLayerName": "eth0" }, { "uplink": true, - "freeUplink": true, "name": "eth1", "networkUUID": "2e6038c1-ece6-4ffd-b95b-a7302c219d59", "lowerLayerName": "eth1" @@ -197,5 +195,58 @@ "ipType": 1, "instType": 2 } - ] + ], + "lispInfo": { + "LispMapServers": [ + { + "NameOrIp": "zedcontrol.zededa.net", + "Credential": "zededa-lispers.net" + } + ], + "LispInstance": 1000, + "EID": "fd5b:8f21:c6b2:2c14:1d41:bd5f:bf40:d6c4", + "EIDHashLen": 120, + "ZedServers": [ + { + "HostName": "zedcontrol", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedlake", + "EID": [ + "fd45:efca:3607:4c1d:eace:a947:3464:d21e" + ] + }, + { + "HostName": "zedbobo", + "EID": [ + "fdd5:79bf:7261:d9df:aea1:c8d2:842d:b99b" + ] + }, + { + "HostName": "hikey02", + "EID": [ + "fdfd:ceef:cf85:7e40:6d4f:2181:ba06:e668" + ] + }, + { + "HostName": "hikey04", + "EID": [ + "fd12:df08:d686:602d:2145:f7cf:2382:1683" + ] + }, + { + "HostName": "hikey05", + "EID": [ + "fd81:abc5:7d7e:bcd7:40d9:df2c:be4b:600" + ] + } + ], + "EidAllocationPrefix": "/Q==", + "EidAllocationPrefixLen": 8 + }, + "manufacturer": "ZedVirtualDevice", + "productName": "ZedVirtual-4G" } From 99977fefc1b78d4f18b262a9e8847502dca14d12 Mon Sep 17 00:00:00 2001 From: giggsoff Date: Tue, 25 Feb 2020 13:30:15 +0300 Subject: [PATCH 4/4] fix rkt create args Signed-off-by: giggsoff --- cmd/rkt_create.go | 2 +- cmd/rkt_utils.go | 55 ++++++++++++++++++++++++++++++++++++++++++ tests/run_local_eve.sh | 3 ++- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/cmd/rkt_create.go b/cmd/rkt_create.go index 31a0818..60ad424 100644 --- a/cmd/rkt_create.go +++ b/cmd/rkt_create.go @@ -57,7 +57,7 @@ func init() { rktCreateCmd.Flags().StringVar(&rktctx.uuidFile, "uuid-file-save", "", "File to save uuid") rktCreateCmd.Flags().StringVar(&rktctx.xenCfgFilename, "xen-cfg-filename", "", "File with xen cfg for stage1") rktCreateCmd.Flags().StringVar(&rktctx.stage1Path, "stage1-path", "/usr/sbin/stage1-xen.aci", "Stage1 path") - + rktCreateCmd.Flags().Var(&rktctx.flagExplicitEnv, "set-env", "environment variable to set for all the apps in the form key=value") //Workaround to start in Ubuntu rktCreateCmd.Flags().BoolVar(&rktctx.noOverlay, "no-overlay", false, "Run without overlay") diff --git a/cmd/rkt_utils.go b/cmd/rkt_utils.go index 45c6f57..6c68718 100644 --- a/cmd/rkt_utils.go +++ b/cmd/rkt_utils.go @@ -2,8 +2,49 @@ package cmd import ( "errors" + "fmt" + "strings" ) +type kvMap struct { + mapping map[string]string +} + +func (e *kvMap) Set(s string) error { + if e.mapping == nil { + e.mapping = make(map[string]string) + } + pair := strings.SplitN(s, "=", 2) + if len(pair) != 2 { + return fmt.Errorf("must be specified as key=value") + } + if _, exists := e.mapping[pair[0]]; exists { + return fmt.Errorf("key %q already set", pair[0]) + } + e.mapping[pair[0]] = pair[1] + return nil +} + +func (e *kvMap) IsEmpty() bool { + return len(e.mapping) == 0 +} + +func (e *kvMap) String() string { + return strings.Join(e.Strings(), "\n") +} + +func (e *kvMap) Strings() []string { + var env []string + for n, v := range e.mapping { + env = append(env, n+"="+v) + } + return env +} + +func (e *kvMap) Type() string { + return "kvMap" +} + type RKTContext struct { dir string insecureOptions string @@ -14,6 +55,8 @@ type RKTContext struct { imageUrl string uuidFile string xenCfgFilename string + stage2MP string + flagExplicitEnv kvMap runPaused bool stage1Path string noOverlay bool @@ -89,6 +132,9 @@ func (ctx RKTContext) rktCreateToCmd() (err error, args []string, envs string) { if ctx.stage1Path != "" { args = append(args, "--stage1-path="+ctx.stage1Path) } + if ctx.uuidFile != "" { + args = append(args, "--uuid-file-save="+ctx.uuidFile) + } if ctx.noOverlay { args = append(args, "--no-overlay") } @@ -98,6 +144,15 @@ func (ctx RKTContext) rktCreateToCmd() (err error, args []string, envs string) { if ctx.xenCfgFilename != "" { envs += " STAGE1_SEED_XL_CFG=" + ctx.xenCfgFilename } + if ctx.stage2MP != "" { + envs += " STAGE2_MNT_PTS=" + ctx.stage2MP + } + explicitEnv := ctx.flagExplicitEnv.Strings() + if len(explicitEnv) > 0 { + for _, el := range explicitEnv { + args = append(args, "--set-env="+el) + } + } err = nil return } diff --git a/tests/run_local_eve.sh b/tests/run_local_eve.sh index 3e4db3e..a978207 100755 --- a/tests/run_local_eve.sh +++ b/tests/run_local_eve.sh @@ -21,7 +21,7 @@ do t) tag_to_use=$OPTARG echo "Use with tag $tag_to_use" ;; u) eve_repo=$OPTARG - echo "Use with repository $eve_rpo" ;; + echo "Use with repository $eve_repo" ;; h) usage ;; *) usage ;; esac @@ -64,6 +64,7 @@ openssl ecparam -name prime256v1 -genkey -noout -out onboard.key.pem openssl req -x509 -new -nodes -key onboard.key.pem -sha256 -subj "/C=RU/ST=SPB/O=MyOrg, Inc./CN=$onboarduuid" -days 1024 -out onboard.cert.pem cd $eve_dir||exit +sed -i "s/zedcloud.alpha.zededa.net/zedcloud.zededa.net/g" conf/server sed -i "s/SandyBridge/host/g" Makefile sed -i "s/31415926/$sn/g" Makefile sed -i "s/-m 4096/-m $memory_to_use/g" Makefile