Change module name to go.fd.io/govpp
[govpp.git] / codec / marshaler_test.go
index b3b20b0..2a9cb94 100644 (file)
@@ -19,12 +19,12 @@ import (
        "reflect"
        "testing"
 
-       "git.fd.io/govpp.git/api"
-       "git.fd.io/govpp.git/binapi/ip_types"
-       "git.fd.io/govpp.git/binapi/sr"
-       "git.fd.io/govpp.git/codec"
-       "git.fd.io/govpp.git/internal/testbinapi/binapi2001/interfaces"
-       "git.fd.io/govpp.git/internal/testbinapi/binapi2001/ip"
+       "go.fd.io/govpp/api"
+       "go.fd.io/govpp/binapi/ip_types"
+       "go.fd.io/govpp/binapi/sr"
+       "go.fd.io/govpp/codec"
+       interfaces "go.fd.io/govpp/binapi/interface"
+       "go.fd.io/govpp/binapi/interface_types"
 )
 
 // CliInband represents VPP binary API message 'cli_inband'.
@@ -102,7 +102,7 @@ func TestWrapperDecode(t *testing.T) {
 
 func TestNewCodecEncodeDecode4(t *testing.T) {
        m := &interfaces.SwInterfaceSetRxMode{
-               Mode:         interfaces.RX_MODE_API_POLLING,
+               Mode:         interface_types.RX_MODE_API_POLLING,
                QueueID:      70000,
                QueueIDValid: true,
                SwIfIndex:    300,
@@ -167,175 +167,3 @@ func TestNewCodecEncodeDecode2(t *testing.T) {
                t.Fatalf("newData differs from oldData")
        }
 }
-
-func TestNewCodecEncode(t *testing.T) {
-       m := NewIPRouteLookupReply()
-       /*m := &sr.SrPoliciesDetails{
-               Bsid:        sr.IP6Address{00, 11, 22, 33, 44, 55, 66, 77, 88, 99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
-               IsSpray:     true,
-               IsEncap:     false,
-               FibTable:    33,
-               NumSidLists: 1,
-               SidLists: []sr.Srv6SidList{
-                       {
-                               Weight:  555,
-                               NumSids: 2,
-                               Sids: [16]sr.IP6Address{
-                                       {99},
-                                       {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
-                               },
-                       },
-               },
-       }*/
-
-       var err error
-       var oldData, newData []byte
-       {
-               w := codec.Wrapper{m}
-               size := m.Size()
-               t.Logf("wrapper size: %d", size)
-               oldData, err = w.Marshal(nil)
-               if err != nil {
-                       t.Fatalf("expected nil error, got: %v", err)
-               }
-       }
-       {
-               size := m.Size()
-               t.Logf("size: %d", size)
-               newData, err = m.Marshal(nil)
-               if err != nil {
-                       t.Fatalf("expected nil error, got: %v", err)
-               }
-       }
-       t.Logf("Data:\nOLD[%d]: % 03x\nNEW[%d]: % 03x", len(oldData), oldData, len(newData), newData)
-
-       if !bytes.Equal(oldData, newData) {
-               t.Fatalf("newData differs from oldData")
-       }
-}
-
-func TestNewCodecDecode(t *testing.T) {
-       data := []byte{
-               0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03,
-               0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00,
-               0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00,
-               0x00, 0x00, 0x08, 0x09, 0x0a, 0x00, 0x00, 0x00,
-               0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-               0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-               0x01, 0x00, 0x00, 0x00, 0x02, 0x01, 0x09, 0x00,
-               0x00, 0x00, 0x08, 0x07, 0x06, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       }
-
-       var err error
-       var oldData, newData ip.IPRouteAddDel
-       {
-               w := codec.Wrapper{&oldData}
-               err = w.Unmarshal(data)
-               if err != nil {
-                       t.Errorf("expected nil error, got: %v", err)
-               }
-       }
-       {
-               err = newData.Unmarshal(data)
-               if err != nil {
-                       t.Errorf("expected nil error, got: %v", err)
-               }
-       }
-       t.Logf("Data:\nOLD: %+v\nNEW: %+v", oldData, newData)
-
-       if !reflect.DeepEqual(oldData, newData) {
-               t.Fatalf("newData differs from oldData")
-       }
-}
-
-func NewIPRouteLookupReply() *ip.IPRouteAddDel {
-       return &ip.IPRouteAddDel{
-               Route: ip.IPRoute{
-                       TableID:    3,
-                       StatsIndex: 5,
-                       Prefix: ip.Prefix{
-                               Address: ip.Address{
-                                       Af: ip.ADDRESS_IP6,
-                                       Un: ip.AddressUnion{},
-                               },
-                               Len: 24,
-                       },
-                       NPaths: 2,
-                       Paths: []ip.FibPath{
-                               {
-                                       SwIfIndex:  5,
-                                       TableID:    6,
-                                       RpfID:      8,
-                                       Weight:     9,
-                                       Preference: 10,
-                                       Type:       11,
-                                       Flags:      1,
-                                       Proto:      2,
-                                       Nh: ip.FibPathNh{
-                                               Address:            ip.AddressUnion{},
-                                               ViaLabel:           3,
-                                               ObjID:              1,
-                                               ClassifyTableIndex: 2,
-                                       },
-                                       NLabels: 1,
-                                       LabelStack: [16]ip.FibMplsLabel{
-                                               {
-                                                       IsUniform: 9,
-                                                       Label:     8,
-                                                       TTL:       7,
-                                                       Exp:       6,
-                                               },
-                                       },
-                               },
-                               {
-                                       SwIfIndex:  7,
-                                       TableID:    6,
-                                       RpfID:      8,
-                                       Weight:     9,
-                                       Preference: 10,
-                                       Type:       11,
-                                       Flags:      1,
-                                       Proto:      1,
-                                       Nh: ip.FibPathNh{
-                                               Address:            ip.AddressUnion{},
-                                               ViaLabel:           3,
-                                               ObjID:              1,
-                                               ClassifyTableIndex: 2,
-                                       },
-                                       NLabels: 2,
-                                       LabelStack: [16]ip.FibMplsLabel{
-                                               {
-                                                       IsUniform: 9,
-                                                       Label:     8,
-                                                       TTL:       7,
-                                                       Exp:       6,
-                                               },
-                                               {
-                                                       IsUniform: 10,
-                                                       Label:     8,
-                                                       TTL:       7,
-                                                       Exp:       6,
-                                               },
-                                       },
-                               },
-                       },
-               },
-       }
-}