|
@@ -1,6 +1,7 @@
|
|
package remote
|
|
package remote
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "bytes"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
"io"
|
|
"io"
|
|
@@ -292,7 +293,7 @@ func TestRemoteDriver(t *testing.T) {
|
|
dst: "vethdst",
|
|
dst: "vethdst",
|
|
address: "192.168.5.7/16",
|
|
address: "192.168.5.7/16",
|
|
addressIPv6: "2001:DB8::5:7/48",
|
|
addressIPv6: "2001:DB8::5:7/48",
|
|
- macAddress: "",
|
|
|
|
|
|
+ macAddress: "ab:cd:ef:ee:ee:ee",
|
|
gateway: "192.168.0.1",
|
|
gateway: "192.168.0.1",
|
|
gatewayIPv6: "2001:DB8::1",
|
|
gatewayIPv6: "2001:DB8::1",
|
|
hostsPath: "/here/comes/the/host/path",
|
|
hostsPath: "/here/comes/the/host/path",
|
|
@@ -328,7 +329,9 @@ func TestRemoteDriver(t *testing.T) {
|
|
})
|
|
})
|
|
handle(t, mux, "CreateEndpoint", func(msg map[string]interface{}) interface{} {
|
|
handle(t, mux, "CreateEndpoint", func(msg map[string]interface{}) interface{} {
|
|
iface := map[string]interface{}{
|
|
iface := map[string]interface{}{
|
|
- "MacAddress": ep.macAddress,
|
|
|
|
|
|
+ "MacAddress": ep.macAddress,
|
|
|
|
+ "Address": ep.address,
|
|
|
|
+ "AddressIPv6": ep.addressIPv6,
|
|
}
|
|
}
|
|
return map[string]interface{}{
|
|
return map[string]interface{}{
|
|
"Interface": iface,
|
|
"Interface": iface,
|
|
@@ -403,11 +406,19 @@ func TestRemoteDriver(t *testing.T) {
|
|
}
|
|
}
|
|
|
|
|
|
endID := "dummy-endpoint"
|
|
endID := "dummy-endpoint"
|
|
- err = d.CreateEndpoint(netID, endID, ep, map[string]interface{}{})
|
|
|
|
|
|
+ ifInfo := &testEndpoint{}
|
|
|
|
+ err = d.CreateEndpoint(netID, endID, ifInfo, map[string]interface{}{})
|
|
if err != nil {
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if !bytes.Equal(ep.MacAddress(), ifInfo.MacAddress()) || !types.CompareIPNet(ep.Address(), ifInfo.Address()) ||
|
|
|
|
+ !types.CompareIPNet(ep.AddressIPv6(), ifInfo.AddressIPv6()) {
|
|
|
|
+ t.Fatalf("Unexpected InterfaceInfo data. Expected (%s, %s, %s). Got (%v, %v, %v)",
|
|
|
|
+ ep.MacAddress(), ep.Address(), ep.AddressIPv6(),
|
|
|
|
+ ifInfo.MacAddress(), ifInfo.Address(), ifInfo.AddressIPv6())
|
|
|
|
+ }
|
|
|
|
+
|
|
joinOpts := map[string]interface{}{"foo": "fooValue"}
|
|
joinOpts := map[string]interface{}{"foo": "fooValue"}
|
|
err = d.Join(netID, endID, "sandbox-key", ep, joinOpts)
|
|
err = d.Join(netID, endID, "sandbox-key", ep, joinOpts)
|
|
if err != nil {
|
|
if err != nil {
|