Browse code

Fix incorrect aux-address examples and test

The (host)name for aux-addresses should
be unique, otherwise later values overwrite
earlier values.

Before this change, the example command
would send this API request;

{
"Attachable": false,
"CheckDuplicate": true,
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Config": [
{
"Gateway": "192.168.0.100",
"IPRange": "192.168.1.0/24",
"Subnet": "192.168.0.0/16"
},
{
"AuxiliaryAddresses": {
"a": "192.170.1.5",
"b": "192.170.1.6"
},
"Gateway": "192.170.0.100",
"Subnet": "192.170.0.0/16"
}
],
"Driver": "default",
"Options": {
}
},
"Internal": false,
"Labels": {
},
"Name": "my-multihost-network",
"Options": {
}
}

After this change, the request looks
like this (all aux-addresses preserved);

{
"Attachable": false,
"CheckDuplicate": true,
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Config": [
{
"AuxiliaryAddresses": {
"my-router": "192.168.1.5",
"my-switch": "192.168.1.6"
},
"Gateway": "192.168.0.100",
"IPRange": "192.168.1.0/24",
"Subnet": "192.168.0.0/16"
},
{
"AuxiliaryAddresses": {
"my-printer": "192.170.1.5",
"my-nas": "192.170.1.6"
},
"Gateway": "192.170.0.100",
"Subnet": "192.170.0.0/16"
}
],
"Driver": "default",
"Options": {
}
},
"Internal": false,
"Labels": {
},
"Name": "my-multihost-network",
"Options": {
}
}

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2016/09/27 08:02:57
Showing 4 changed files
... ...
@@ -136,8 +136,8 @@ $ docker network create -d overlay \
136 136
   --gateway=192.168.0.100 \ 
137 137
   --gateway=192.170.0.100 \
138 138
   --ip-range=192.168.1.0/24 \
139
-  --aux-address a=192.168.1.5 --aux-address b=192.168.1.6 \
140
-  --aux-address a=192.170.1.5 --aux-address b=192.170.1.6 \
139
+  --aux-address="my-router=192.168.1.5" --aux-address="my-switch=192.168.1.6" \
140
+  --aux-address="my-printer=192.170.1.5" --aux-address="my-nas=192.170.1.6" \
141 141
   my-multihost-network
142 142
 ```
143 143
 
... ...
@@ -106,8 +106,8 @@ $ docker network create -d overlay \
106 106
   --gateway=192.168.0.100 \
107 107
   --gateway=192.170.0.100 \
108 108
   --ip-range=192.168.1.0/24 \
109
-  --aux-address a=192.168.1.5 --aux-address b=192.168.1.6 \
110
-  --aux-address a=192.170.1.5 --aux-address b=192.170.1.6 \
109
+  --aux-address="my-router=192.168.1.5" --aux-address="my-switch=192.168.1.6" \
110
+  --aux-address="my-printer=192.170.1.5" --aux-address="my-nas=192.170.1.6" \
111 111
   my-multihost-network
112 112
 ```
113 113
 
... ...
@@ -631,7 +631,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkIpamMultipleNetworks(c *check.C) {
631 631
 		"--gateway=192.168.0.100", "--gateway=192.170.0.100",
632 632
 		"--ip-range=192.168.1.0/24",
633 633
 		"--aux-address", "a=192.168.1.5", "--aux-address", "b=192.168.1.6",
634
-		"--aux-address", "a=192.170.1.5", "--aux-address", "b=192.170.1.6",
634
+		"--aux-address", "c=192.170.1.5", "--aux-address", "d=192.170.1.6",
635 635
 		"test7")
636 636
 	assertNwIsAvailable(c, "test7")
637 637
 
... ...
@@ -127,8 +127,8 @@ $ docker network create -d overlay \
127 127
   --gateway=192.168.0.100 \ 
128 128
   --gateway=192.170.0.100 \
129 129
   --ip-range=192.168.1.0/24 \
130
-  --aux-address a=192.168.1.5 --aux-address b=192.168.1.6 \
131
-  --aux-address a=192.170.1.5 --aux-address b=192.170.1.6 \
130
+  --aux-address="my-router=192.168.1.5" --aux-address="my-switch=192.168.1.6" \
131
+  --aux-address="my-printer=192.170.1.5" --aux-address="my-nas=192.170.1.6" \
132 132
   my-multihost-network
133 133
 ```
134 134