remove .out files
authorMike Cambria <michael.cambria@one.verizon.com>
Thu, 7 Sep 2017 16:07:00 +0000 (12:07 -0400)
committerMike Cambria <michael.cambria@one.verizon.com>
Thu, 7 Sep 2017 16:07:00 +0000 (12:07 -0400)
15 files changed:
cni-test-add.sh [new file with mode: 0755]
cni-test-del.sh [new file with mode: 0755]
cni-test.conf [new file with mode: 0644]
diff-allocator.out [new file with mode: 0644]
diff-config.out [new file with mode: 0644]
diff.out [new file with mode: 0644]
mesos-test-add.sh [new file with mode: 0755]
mesos-test-del.sh [new file with mode: 0755]
mesos-test.conf [new file with mode: 0644]
remove-cnibgp.sh [new file with mode: 0755]
setup-test0-ns.sh [new file with mode: 0755]
test-add.sh [new file with mode: 0755]
test-del.sh [new file with mode: 0755]
test.conf [new file with mode: 0644]
vz-plugin-test.conf [new file with mode: 0644]

diff --git a/cni-test-add.sh b/cni-test-add.sh
new file mode 100755 (executable)
index 0000000..ad2aad1
--- /dev/null
@@ -0,0 +1,11 @@
+#/bin/bash
+export DEBUG=1
+export NETCONFPATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins
+export CNI_PATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins/bin
+
+#export CNI_ARGS="IP=10.244.10.20"
+export MCCVAL="Jamal Env Value"
+
+sudo -E /home/mcambria/go2/src/github.com/verizonlabs/cni/bin/cnitool add cni-test /var/run/netns/test0
+
+
diff --git a/cni-test-del.sh b/cni-test-del.sh
new file mode 100755 (executable)
index 0000000..b031e15
--- /dev/null
@@ -0,0 +1,11 @@
+#/bin/bash
+export DEBUG=1
+export NETCONFPATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins
+export CNI_PATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins/bin
+
+#export CNI_ARGS="IP=10.244.10.20"
+export MCCVAL="Jamal Env Value"
+
+sudo -E /home/mcambria/go2/src/github.com/verizonlabs/cni/bin/cnitool del cni-test /var/run/netns/test0
+
+
diff --git a/cni-test.conf b/cni-test.conf
new file mode 100644 (file)
index 0000000..1d43e55
--- /dev/null
@@ -0,0 +1,24 @@
+{
+  "name": "cni-test",
+  "cniVersion": "0.3.0",
+      "type": "bridge",
+      "bridge": "cnibgp",
+      "ipMasq": true,
+      "isGateway": true,
+      "isDefaultGateway": true,
+    "args" : {
+      "cni" : {
+       "ips": ["10.244.10.19"]
+      }
+    },
+      "ipam": {
+       "type": "vz-local",
+       "subnet": "10.244.10.0/24",
+       "rangeStart": "10.244.10.2",
+       "rangeEnd": "10.244.10.25",
+       "routes": [
+          { "dst": "0.0.0.0/0"  }
+       ]
+      }
+}
+
diff --git a/diff-allocator.out b/diff-allocator.out
new file mode 100644 (file)
index 0000000..cf25050
--- /dev/null
@@ -0,0 +1,99 @@
+26c26,30
+<      "github.com/containernetworking/plugins/plugins/ipam/host-local/backend"
+---
+>      "github.com/containernetworking/plugins/plugins/ipam/vz-local/backend"
+> 
+>      //"github.com/vishvananda/netlink"
+>      //"os"
+>      //"syscall"
+69a74,75
+>              log.Println("AdvRoute: BGP Advertises /32", requestedIP)
+> 
+113a120,159
+> 
+> /*
+> comment test 
+>         var uplink types.UnmarshallableString
+>      if a.conf.Args != nil {
+>          uplink = a.conf.Args.UPLINK
+>          log.Println("AdvRoute: BGP Advertises /32", requestedIP, uplink)
+> 
+>           dst := &net.IPNet{
+>                       IP: requestedIP,
+>                       Mask: net.CIDRMask(32, 32),
+>                       }
+> 
+>             link, err := netlink.LinkByName(string(uplink))
+>             if err != nil {
+>                log.Println("Can't obtain link index for: ", uplink)
+>                return nil, nil, err
+>             }
+> 
+>             viaIP := a.conf.Args.VIAIP
+>             route := netlink.Route{
+>                         Dst: dst,
+>                         LinkIndex: link.Attrs().Index,
+>                         Gw: viaIP,
+>                         }
+> 
+>             if err := netlink.RouteAdd(&route); err != nil {
+>                 fmt.Fprintln(os.Stderr, "There was an error adding netlink route: ", err)
+>                 if (err == syscall.EAGAIN) {
+>                     log.Println("ERRNO: eagain")
+>                 } else if (err == syscall.EEXIST) {
+>                     log.Println("ERRNO: route already exists")
+>                 } else {
+>                     log.Println("ERRNO: value is: ", (int(err.(syscall.Errno))))
+>                 }
+>                 return nil, nil, err
+>             }
+>         }
+> 
+> */
+129a176,221
+> 
+> /*
+>         var requestedIP net.IP
+>      if a.conf.Args != nil {
+>                requestedIP = a.conf.Args.IP
+>      }
+> 
+>      if requestedIP != nil {
+>            //var uplink string
+>               var uplink types.UnmarshallableString
+>               if a.conf.Args != nil {
+>                    uplink = a.conf.Args.UPLINK
+>                    log.Println("AdvRoute: BGP Advertises /32", requestedIP, uplink)
+>                 dst := &net.IPNet{
+>                            // IP: net.IPv4(99, 44, 69, 3),
+>                            IP: requestedIP,
+>                            Mask: net.CIDRMask(32, 32),
+>                            }
+> 
+>                 link, err := netlink.LinkByName(string(uplink))
+>                 if err != nil {
+>                           log.Println("Can't obtain link index for: ", uplink)
+>                           return err1
+>                 }
+> 
+>                    viaIP := a.conf.Args.VIAIP
+>                    route := netlink.Route{
+>                               Dst: dst,
+>                               LinkIndex: link.Attrs().Index,
+>                               Gw: viaIP,
+>                               }
+> 
+>                 if err := netlink.RouteDel(&route); err != nil {
+>                           fmt.Fprintln(os.Stderr, "There was an error removing netlink route: ", err)
+>                           if (err == syscall.EAGAIN) {
+>                                   log.Println("ERRNO: eagain")
+>                           } else if (err == syscall.ESRCH) {
+>                                   log.Println("ERRNO: route doesn't exists")
+>                           } else {
+>                                      log.Println("ERRNO: value is: ", (int(err.(syscall.Errno))))
+>                              }
+>                              // os.Exit(1)
+>                              return err
+>               }
+>         }
+> */
diff --git a/diff-config.out b/diff-config.out
new file mode 100644 (file)
index 0000000..e2d7cc7
--- /dev/null
@@ -0,0 +1,133 @@
+21a22,24
+>      "log"
+>      "os"
+> 
+42a46,47
+>         VIAIP net.IP `json:"viaip,omitempty"`
+>      UPLINK types.UnmarshallableString `json:"uplink,omitempty"`
+46a52,64
+>      VIAIP net.IP `json:"viaip,omitempty"`
+>      UPLINK types.UnmarshallableString `json:"uplink,omitempty"`
+> }
+> 
+> /*
+>  * Add structs needed to parse labels
+>  */
+> //type Args struct {
+> //     Mesos Mesos `json:"org.apache.mesos,omitempty"`
+> //}
+> 
+> type Mesos struct {
+>      NetworkInfo NetworkInfo `json:"network_info"`
+48a67,86
+> type NetworkInfo struct {
+>      Name   string `json:"name"`
+>      Labels struct {
+>               Labels []struct {
+>                   Key   string `json:"key"`
+>                   Value string `json:"value"`
+>               } `json:"labels,omitempty"`
+>      } `json:"labels,omitempty"`
+> }
+> 
+> // NetConf describes a network.
+> //type NetConf struct {
+> //       CNIVersion string `json:"cniVersion,omitempty"`
+> //       Name string `json:"name,omitempty"`
+> //       Type string `json:"type,omitempty"`
+> //       IPAM *IPAMConfig `json:"ipam"`
+> //       DNS types.DNS `json:"dns"`
+> //       ARGS *Args `json:"args,omitempty"`
+> //}
+> 
+55a94
+>              Mesos Mesos `json:"org.apache.mesos,omitempty"`
+67a107
+>      //n := NetConf{}
+145a186,271
+> 
+>         /*
+>          * Example of getting an environment variable supplied to the IPAM plugin
+>          */
+>         mccval := os.Getenv("MCCVAL")
+>         println("mccval is: ", mccval)
+> 
+>         /*
+>          * Get values for supplied labels
+>          * Ensure that IPAM args (e.g. CNI_ARGS) isn't confused with args passed to CNI itself
+>          */
+>         labels := map[string]string{}
+> 
+>           if n.Args != nil {
+> 
+>                 for k, label := range n.Args.Mesos.NetworkInfo.Labels.Labels {
+>                     labels[label.Key] = label.Value
+>                     println("Map k (for)", k)
+>                     println("Map k (for)", k, label.Key, label.Value)
+>                 }
+> 
+>                 println("CNI Args NetworkInfo: Net Name: ", n.Args.Mesos.NetworkInfo.Name)
+>           }
+> 
+>         for key, value := range labels {
+>             println("Key:", key, "Value:", value)
+>         }
+> 
+>         println("CNI IPAM Name: ", n.IPAM.Name)
+> 
+>         if n.IPAM.Args != nil {
+>                 var args_ip net.IP
+>                 if n.IPAM.Args.IP != nil {
+>                    args_ip = n.IPAM.Args.IP
+>                    log.Println("IPAM args: n.IPAM.IP is:", args_ip)
+>                 }
+> 
+>                 var via_ip net.IP
+>                 if n.IPAM.Args.VIAIP != nil {
+>                    via_ip = n.IPAM.Args.VIAIP
+>                    log.Println("IPAM args: n.IPAM.VIAIP is:", via_ip)
+>                 }
+> 
+>                 var uplink types.UnmarshallableString
+>                 if n.IPAM.Args.UPLINK != "" {
+>                    uplink = n.IPAM.Args.UPLINK
+>                    log.Println("IPAM args: n.IPAM.UPLINK is:", uplink)
+>                 }
+>         }
+> 
+>         staticIP, found := labels["StaticIP"]
+>         if found {
+>            println("StaticIP is: ", staticIP)
+>            log.Println("StaticIP is: ", staticIP)
+>            n.IPAM.Args.IP = net.ParseIP(staticIP)
+>            log.Println("IPAM args: n.IPAM.IP is:", n.IPAM.Args.IP)
+>         } else {
+>            println("StaticIP label NOT set")
+>         }
+> 
+>         viaIP, found := labels["viaIP"]
+>         if found {
+>            println("viaIP is: ", viaIP)
+>            log.Println("viaIP is: ", viaIP)
+>            n.IPAM.Args.VIAIP = net.ParseIP(viaIP)
+>            log.Println("IPAM args: n.IPAM.VIAIP is:", n.IPAM.Args.VIAIP)
+>         } else {
+>            println("viaIP label NOT set")
+>         }
+> 
+>         Uplink, found := labels["Uplink"]
+>         if found {
+>            println("Uplink is: ", Uplink)
+>            log.Println("Uplink is: ", Uplink)
+>            n.IPAM.Args.UPLINK= types.UnmarshallableString(Uplink)
+>            log.Println("IPAM args: n.IPAM.UPLINK is:", n.IPAM.Args.UPLINK)
+>         } else {
+>            println("Uplink label NOT set")
+>         }
+> 
+>         bull, found := labels["bull"]
+>         if !found {
+>            println("Hard to believe, but bull not found")
+>         } else {
+>            println("Found: ", bull)
+>         }
diff --git a/diff.out b/diff.out
new file mode 100644 (file)
index 0000000..60a805f
--- /dev/null
+++ b/diff.out
@@ -0,0 +1,133 @@
+21a22,24
+>      "log"
+>      "os"
+> 
+42a46,47
+>         VIAIP net.IP `json:"viaip,omitempty"`
+>      UPLINK types.UnmarshallableString `json:"uplink,omitempty"`
+46a52,84
+>      VIAIP net.IP `json:"viaip,omitempty"`
+>      UPLINK types.UnmarshallableString `json:"uplink,omitempty"`
+> }
+> 
+> /*
+>  * Add structs needed to parse labels
+>  */
+> type Args struct {
+>      Mesos Mesos `json:"org.apache.mesos,omitempty"`
+> }
+> 
+> type Mesos struct {
+>      NetworkInfo NetworkInfo `json:"network_info"`
+> }
+> 
+> type NetworkInfo struct {
+>      Name   string `json:"name"`
+>      Labels struct {
+>               Labels []struct {
+>                   Key   string `json:"key"`
+>                   Value string `json:"value"`
+>               } `json:"labels,omitempty"`
+>      } `json:"labels,omitempty"`
+> }
+> 
+> // NetConf describes a network.
+> type NetConf struct {
+>        CNIVersion string `json:"cniVersion,omitempty"`
+>        Name string `json:"name,omitempty"`
+>        Type string `json:"type,omitempty"`
+>        IPAM *IPAMConfig `json:"ipam"`
+>        DNS types.DNS `json:"dns"`
+>        ARGS *Args `json:"args,omitempty"`
+68c106,107
+<      n := Net{}
+---
+>      //n := Net{}
+>      n := NetConf{}
+145a185,270
+> 
+>         /*
+>          * Example of getting an environment variable supplied to the IPAM plugin
+>          */
+>         mccval := os.Getenv("MCCVAL")
+>         println("mccval is: ", mccval)
+> 
+>         /*
+>          * Get values for supplied labels
+>          * Ensure that IPAM args (e.g. CNI_ARGS) isn't confused with args passed to CNI itself
+>          */
+>         labels := map[string]string{}
+> 
+>           if n.ARGS != nil {
+> 
+>                 for k, label := range n.ARGS.Mesos.NetworkInfo.Labels.Labels {
+>                     labels[label.Key] = label.Value
+>                     println("Map k (for)", k)
+>                     println("Map k (for)", k, label.Key, label.Value)
+>                 }
+> 
+>                 println("CNI Args NetworkInfo: Net Name: ", n.ARGS.Mesos.NetworkInfo.Name)
+>           }
+> 
+>         for key, value := range labels {
+>             println("Key:", key, "Value:", value)
+>         }
+> 
+>         println("CNI IPAM Name: ", n.IPAM.Name)
+> 
+>         if n.IPAM.Args != nil {
+>                 var args_ip net.IP
+>                 if n.IPAM.Args.IP != nil {
+>                    args_ip = n.IPAM.Args.IP
+>                    log.Println("IPAM args: n.IPAM.IP is:", args_ip)
+>                 }
+> 
+>                 var via_ip net.IP
+>                 if n.IPAM.Args.VIAIP != nil {
+>                    via_ip = n.IPAM.Args.VIAIP
+>                    log.Println("IPAM args: n.IPAM.VIAIP is:", via_ip)
+>                 }
+> 
+>                 var uplink types.UnmarshallableString
+>                 if n.IPAM.Args.UPLINK != "" {
+>                    uplink = n.IPAM.Args.UPLINK
+>                    log.Println("IPAM args: n.IPAM.UPLINK is:", uplink)
+>                 }
+>         }
+> 
+>         staticIP, found := labels["StaticIP"]
+>         if found {
+>            println("StaticIP is: ", staticIP)
+>            log.Println("StaticIP is: ", staticIP)
+>            n.IPAM.Args.IP = net.ParseIP(staticIP)
+>            log.Println("IPAM args: n.IPAM.IP is:", n.IPAM.Args.IP)
+>         } else {
+>            println("StaticIP label NOT set")
+>         }
+> 
+>         viaIP, found := labels["viaIP"]
+>         if found {
+>            println("viaIP is: ", viaIP)
+>            log.Println("viaIP is: ", viaIP)
+>            n.IPAM.Args.VIAIP = net.ParseIP(viaIP)
+>            log.Println("IPAM args: n.IPAM.VIAIP is:", n.IPAM.Args.VIAIP)
+>         } else {
+>            println("viaIP label NOT set")
+>         }
+> 
+>         Uplink, found := labels["Uplink"]
+>         if found {
+>            println("Uplink is: ", Uplink)
+>            log.Println("Uplink is: ", Uplink)
+>            n.IPAM.Args.UPLINK= types.UnmarshallableString(Uplink)
+>            log.Println("IPAM args: n.IPAM.UPLINK is:", n.IPAM.Args.UPLINK)
+>         } else {
+>            println("Uplink label NOT set")
+>         }
+> 
+>         bull, found := labels["bull"]
+>         if !found {
+>            println("Hard to believe, but bull not found")
+>         } else {
+>            println("Found: ", bull)
+>         }
diff --git a/mesos-test-add.sh b/mesos-test-add.sh
new file mode 100755 (executable)
index 0000000..06b6540
--- /dev/null
@@ -0,0 +1,13 @@
+#/bin/bash
+export DEBUG=1
+export NETCONFPATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins
+export CNI_PATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins/bin
+
+export CNI_ARGS="IP=10.244.10.10"
+export MCCVAL="Jamal Env Value"
+
+# sudo -E /home/mcambria/go2/src/github.com/verizonlabs/cni/bin/cnitool add mesos-test /var/run/netns/test0
+
+sudo -E /home/mcambria/go2/src/github.com/verizonlabs/cni/bin/cnitool add vz-plugin-test /var/run/netns/test0
+
+
diff --git a/mesos-test-del.sh b/mesos-test-del.sh
new file mode 100755 (executable)
index 0000000..8cfb3fc
--- /dev/null
@@ -0,0 +1,13 @@
+#/bin/bash
+export DEBUG=1
+export NETCONFPATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins
+export CNI_PATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins/bin
+
+export CNI_ARGS="IP=10.244.10.10"
+export MCCVAL="Jamal Env Value"
+
+#sudo -E /home/mcambria/go2/src/github.com/verizonlabs/cni/bin/cnitool del mesos-test /var/run/netns/test0
+
+sudo -E /home/mcambria/go2/src/github.com/verizonlabs/cni/bin/cnitool del vz-plugin-test /var/run/netns/test0
+
+
diff --git a/mesos-test.conf b/mesos-test.conf
new file mode 100644 (file)
index 0000000..8daef53
--- /dev/null
@@ -0,0 +1,41 @@
+{
+  "name": "mesos-test",
+  "cniVersion": "0.3.0",
+      "type": "vz-bridge",
+      "bridge": "cnibgp",
+      "ipMasq": true,
+      "isGateway": true,
+      "isDefaultGateway": true,
+    "args" : {
+      "org.apache.mesos" : {
+        "network_info" : {
+          "name" : "mynet",
+          "labels" : {
+            "labels" : [
+              { "key" : "app", "value" : "myapp" },
+              { "key" : "mccKey1", "value" : "mccVal1" },
+              { "key" : "bs", "value" : "bsVal" },
+              { "key" : "StaticIP", "value" : "10.244.10.22"},
+              { "key" : "Uplink", "value" : "cnibgp" },
+              { "key" : "viaIP", "value" : "10.244.10.1" },
+              { "key" : "mccKey2", "value" : "mccVal2" },
+              { "key" : "env", "value" : "prod" }
+            ]
+          }
+        }
+      },
+      "cni" : {
+       "ips": ["10.244.10.19"]
+      }
+    },
+      "ipam": {
+       "type": "vz-local",
+       "subnet": "10.244.10.0/24",
+       "rangeStart": "10.244.10.2",
+       "rangeEnd": "10.244.10.25",
+       "routes": [
+          { "dst": "0.0.0.0/0"  }
+       ]
+      }
+}
+
diff --git a/remove-cnibgp.sh b/remove-cnibgp.sh
new file mode 100755 (executable)
index 0000000..c304fc5
--- /dev/null
@@ -0,0 +1,5 @@
+#/bin/bash
+sudo ip addr del 10.244.10.1/24 dev cnibgp 
+sudo ip link set cnibgp down 
+sudo brctl delbr cnibgp 
+
diff --git a/setup-test0-ns.sh b/setup-test0-ns.sh
new file mode 100755 (executable)
index 0000000..1995701
--- /dev/null
@@ -0,0 +1,5 @@
+#/bin/bash
+sudo ip netns del test0
+sudo ip netns add test0
+sudo ip netns exec test0 ip addr show
+
diff --git a/test-add.sh b/test-add.sh
new file mode 100755 (executable)
index 0000000..dadaa34
--- /dev/null
@@ -0,0 +1,11 @@
+#/bin/bash
+export DEBUG=1
+export NETCONFPATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins
+export CNI_PATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins/bin
+
+#export CNI_ARGS="IP=10.244.10.20"
+export MCCVAL="Jamal Env Value"
+
+sudo -E /home/mcambria/go2/src/github.com/verizonlabs/cni/bin/cnitool add test /var/run/netns/test0
+
+
diff --git a/test-del.sh b/test-del.sh
new file mode 100755 (executable)
index 0000000..32ef103
--- /dev/null
@@ -0,0 +1,11 @@
+#/bin/bash
+export DEBUG=1
+export NETCONFPATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins
+export CNI_PATH=/home/mcambria/go2/src/github.com/verizonlabs/plugins/bin
+
+#export CNI_ARGS="IP=10.244.10.20"
+export MCCVAL="Jamal Env Value"
+
+sudo -E /home/mcambria/go2/src/github.com/verizonlabs/cni/bin/cnitool del test /var/run/netns/test0
+
+
diff --git a/test.conf b/test.conf
new file mode 100644 (file)
index 0000000..17c5fd3
--- /dev/null
+++ b/test.conf
@@ -0,0 +1,19 @@
+{
+  "name": "test",
+  "cniVersion": "0.3.0",
+      "type": "bridge",
+      "bridge": "cnibgp",
+      "ipMasq": true,
+      "isGateway": true,
+      "isDefaultGateway": true,
+      "ipam": {
+       "type": "vz-local",
+       "subnet": "10.244.10.0/24",
+       "rangeStart": "10.244.10.2",
+       "rangeEnd": "10.244.10.25",
+       "routes": [
+          { "dst": "0.0.0.0/0"  }
+       ]
+      }
+}
+
diff --git a/vz-plugin-test.conf b/vz-plugin-test.conf
new file mode 100644 (file)
index 0000000..2a19be2
--- /dev/null
@@ -0,0 +1,38 @@
+{
+  "name": "vz-plugin-test",
+  "cniVersion": "0.3.0",
+      "type": "vz-bridge",
+      "bridge": "cnibgp",
+      "ipMasq": true,
+      "isGateway": true,
+      "isDefaultGateway": true,
+    "args" : {
+      "org.apache.mesos" : {
+        "network_info" : {
+          "name" : "mynet",
+          "labels" : {
+            "labels" : [
+              { "key" : "app", "value" : "myapp" },
+              { "key" : "mccKey1", "value" : "mccVal1" },
+              { "key" : "bs", "value" : "bsVal" },
+              { "key" : "OldStaticIP", "value" : "10.244.10.22"},
+              { "key" : "Uplink", "value" : "cnibgp" },
+              { "key" : "viaIP", "value" : "10.244.10.1" },
+              { "key" : "mccKey2", "value" : "mccVal2" },
+              { "key" : "env", "value" : "prod" }
+            ]
+          }
+        }
+      }
+    },
+      "ipam": {
+       "type": "host-local",
+       "subnet": "10.244.10.0/24",
+       "rangeStart": "10.244.10.2",
+       "rangeEnd": "10.244.10.25",
+       "routes": [
+          { "dst": "0.0.0.0/0"  }
+       ]
+      }
+}
+