@@ -1417,48 +1417,30 @@ func mustVerifyFlowBundle(t *testing.T, stdin io.Reader, flows []*Flow, matchFlo
14171417}
14181418
14191419func TestClientOpenFlowDumpPortMappingsOK (t * testing.T ) {
1420- want := map [string ]* PortMapping {
1420+ want := map [string ]* PortAttr {
14211421 "interface1" : {
1422- portAttr : PortAttr {
1423- ofPort : 7 ,
1424- macAddress : "fe:4f:76:09:88:2b" ,
1425- },
1426- ifName : "interface1" ,
1422+ ofPort : 7 ,
1423+ macAddress : "fe:4f:76:09:88:2b" ,
14271424 },
14281425 "interface2" : {
1429- portAttr : PortAttr {
1430- ofPort : 8 ,
1431- macAddress : "fe:be:7b:0d:53:d8" ,
1432- },
1433- ifName : "interface2" ,
1426+ ofPort : 8 ,
1427+ macAddress : "fe:be:7b:0d:53:d8" ,
14341428 },
14351429 "interface3" : {
1436- portAttr : PortAttr {
1437- ofPort : 9 ,
1438- macAddress : "fe:b6:4c:d5:40:79" ,
1439- },
1440- ifName : "interface3" ,
1430+ ofPort : 9 ,
1431+ macAddress : "fe:b6:4c:d5:40:79" ,
14411432 },
14421433 "interface4" : {
1443- portAttr : PortAttr {
1444- ofPort : 20 ,
1445- macAddress : "fe:cf:a6:90:30:29" ,
1446- },
1447- ifName : "interface4" ,
1434+ ofPort : 20 ,
1435+ macAddress : "fe:cf:a6:90:30:29" ,
14481436 },
14491437 "LOCAL" : {
1450- portAttr : PortAttr {
1451- ofPort : 65534 ,
1452- macAddress : "fe:74:0f:80:cf:9a" ,
1453- },
1454- ifName : "LOCAL" ,
1438+ ofPort : 65534 ,
1439+ macAddress : "fe:74:0f:80:cf:9a" ,
14551440 },
14561441 "eth0" : {
1457- portAttr : PortAttr {
1458- ofPort : 1 ,
1459- macAddress : "aa:bb:cc:dd:ee:ff" ,
1460- },
1461- ifName : "eth0" ,
1442+ ofPort : 1 ,
1443+ macAddress : "aa:bb:cc:dd:ee:ff" ,
14621444 },
14631445 }
14641446
@@ -1529,14 +1511,14 @@ actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_d
15291511 t .Fatalf ("missing mapping for interface %q" , name )
15301512 }
15311513
1532- if wantMapping .portAttr . ofPort != gotMapping . portAttr .ofPort {
1514+ if wantMapping .ofPort != gotMapping .ofPort {
15331515 t .Fatalf ("unexpected ofPort for %q:\n - want: %d\n - got: %d" ,
1534- name , wantMapping .portAttr . ofPort , gotMapping . portAttr .ofPort )
1516+ name , wantMapping .ofPort , gotMapping .ofPort )
15351517 }
15361518
1537- if wantMapping .portAttr . macAddress != gotMapping . portAttr .macAddress {
1519+ if wantMapping .macAddress != gotMapping .macAddress {
15381520 t .Fatalf ("unexpected macAddress for %q:\n - want: %q\n - got: %q" ,
1539- name , wantMapping .portAttr . macAddress , gotMapping . portAttr .macAddress )
1521+ name , wantMapping .macAddress , gotMapping .macAddress )
15401522 }
15411523 }
15421524
@@ -1564,20 +1546,14 @@ func TestClientOpenFlowDumpPortMappingsEmptyOutput(t *testing.T) {
15641546}
15651547
15661548func TestClientOpenFlowDumpPortMappingsAllInterfaces (t * testing.T ) {
1567- want := map [string ]* PortMapping {
1549+ want := map [string ]* PortAttr {
15681550 "eth0" : {
1569- portAttr : PortAttr {
1570- ofPort : 1 ,
1571- macAddress : "aa:bb:cc:dd:ee:ff" ,
1572- },
1573- ifName : "eth0" ,
1551+ ofPort : 1 ,
1552+ macAddress : "aa:bb:cc:dd:ee:ff" ,
15741553 },
15751554 "eth1" : {
1576- portAttr : PortAttr {
1577- ofPort : 2 ,
1578- macAddress : "11:22:33:44:55:66" ,
1579- },
1580- ifName : "eth1" ,
1555+ ofPort : 2 ,
1556+ macAddress : "11:22:33:44:55:66" ,
15811557 },
15821558 }
15831559
@@ -1606,14 +1582,14 @@ OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
16061582 t .Fatalf ("missing mapping for interface %q" , name )
16071583 }
16081584
1609- if wantMapping .portAttr . ofPort != gotMapping . portAttr .ofPort {
1585+ if wantMapping .ofPort != gotMapping .ofPort {
16101586 t .Fatalf ("unexpected ofPort for %q:\n - want: %d\n - got: %d" ,
1611- name , wantMapping .portAttr . ofPort , gotMapping . portAttr .ofPort )
1587+ name , wantMapping .ofPort , gotMapping .ofPort )
16121588 }
16131589
1614- if wantMapping .portAttr . macAddress != gotMapping . portAttr .macAddress {
1590+ if wantMapping .macAddress != gotMapping .macAddress {
16151591 t .Fatalf ("unexpected macAddress for %q:\n - want: %q\n - got: %q" ,
1616- name , wantMapping .portAttr . macAddress , gotMapping . portAttr .macAddress )
1592+ name , wantMapping .macAddress , gotMapping .macAddress )
16171593 }
16181594 }
16191595}
@@ -1622,18 +1598,15 @@ func TestClientOpenFlowDumpPortMappingsForInterface(t *testing.T) {
16221598 tests := []struct {
16231599 name string
16241600 interfaceName string
1625- want * PortMapping
1601+ want * PortAttr
16261602 output string
16271603 }{
16281604 {
16291605 name : "LOCAL interface" ,
16301606 interfaceName : "LOCAL" ,
1631- want : & PortMapping {
1632- portAttr : PortAttr {
1633- ofPort : 65534 ,
1634- macAddress : "fe:74:0f:80:cf:9a" ,
1635- },
1636- ifName : "LOCAL" ,
1607+ want : & PortAttr {
1608+ ofPort : 65534 ,
1609+ macAddress : "fe:74:0f:80:cf:9a" ,
16371610 },
16381611 output : `
16391612OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
@@ -1643,12 +1616,9 @@ OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
16431616 {
16441617 name : "interface1" ,
16451618 interfaceName : "interface1" ,
1646- want : & PortMapping {
1647- portAttr : PortAttr {
1648- ofPort : 7 ,
1649- macAddress : "fe:4f:76:09:88:2b" ,
1650- },
1651- ifName : "interface1" ,
1619+ want : & PortAttr {
1620+ ofPort : 7 ,
1621+ macAddress : "fe:4f:76:09:88:2b" ,
16521622 },
16531623 output : `
16541624OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
@@ -1675,14 +1645,14 @@ OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
16751645 t .Fatalf ("missing mapping for interface %q" , tt .interfaceName )
16761646 }
16771647
1678- if tt .want .portAttr . ofPort != gotMapping . portAttr .ofPort {
1648+ if tt .want .ofPort != gotMapping .ofPort {
16791649 t .Fatalf ("unexpected ofPort for %q:\n - want: %d\n - got: %d" ,
1680- tt .interfaceName , tt .want .portAttr . ofPort , gotMapping . portAttr .ofPort )
1650+ tt .interfaceName , tt .want .ofPort , gotMapping .ofPort )
16811651 }
16821652
1683- if tt .want .portAttr . macAddress != gotMapping . portAttr .macAddress {
1653+ if tt .want .macAddress != gotMapping .macAddress {
16841654 t .Fatalf ("unexpected macAddress for %q:\n - want: %q\n - got: %q" ,
1685- tt .interfaceName , tt .want .portAttr . macAddress , gotMapping . portAttr .macAddress )
1655+ tt .interfaceName , tt .want .macAddress , gotMapping .macAddress )
16861656 }
16871657 })
16881658 }
@@ -1710,20 +1680,17 @@ func TestClientOpenFlowDumpPortMapping(t *testing.T) {
17101680 tests := []struct {
17111681 name string
17121682 interfaceName string
1713- want * PortMapping
1683+ want * PortAttr
17141684 output string
17151685 wantErr bool
17161686 errMsg string
17171687 }{
17181688 {
17191689 name : "successful retrieval" ,
17201690 interfaceName : "interface1" ,
1721- want : & PortMapping {
1722- portAttr : PortAttr {
1723- ofPort : 7 ,
1724- macAddress : "fe:4f:76:09:88:2b" ,
1725- },
1726- ifName : "interface1" ,
1691+ want : & PortAttr {
1692+ ofPort : 7 ,
1693+ macAddress : "fe:4f:76:09:88:2b" ,
17271694 },
17281695 output : `
17291696OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
@@ -1745,12 +1712,9 @@ OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
17451712 {
17461713 name : "LOCAL interface" ,
17471714 interfaceName : "LOCAL" ,
1748- want : & PortMapping {
1749- portAttr : PortAttr {
1750- ofPort : 65534 ,
1751- macAddress : "fe:74:0f:80:cf:9a" ,
1752- },
1753- ifName : "LOCAL" ,
1715+ want : & PortAttr {
1716+ ofPort : 65534 ,
1717+ macAddress : "fe:74:0f:80:cf:9a" ,
17541718 },
17551719 output : `
17561720OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
@@ -1783,14 +1747,14 @@ OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000000000001
17831747 t .Fatalf ("unexpected error: %v" , err )
17841748 }
17851749
1786- if tt .want .portAttr . ofPort != got . portAttr .ofPort {
1750+ if tt .want .ofPort != got .ofPort {
17871751 t .Fatalf ("unexpected ofPort:\n - want: %d\n - got: %d" ,
1788- tt .want .portAttr . ofPort , got . portAttr .ofPort )
1752+ tt .want .ofPort , got .ofPort )
17891753 }
17901754
1791- if tt .want .portAttr . macAddress != got . portAttr .macAddress {
1755+ if tt .want .macAddress != got .macAddress {
17921756 t .Fatalf ("unexpected macAddress:\n - want: %q\n - got: %q" ,
1793- tt .want .portAttr . macAddress , got . portAttr .macAddress )
1757+ tt .want .macAddress , got .macAddress )
17941758 }
17951759 })
17961760 }
0 commit comments