contiv / netplugin

Container networking for various use cases
Apache License 2.0
515 stars 177 forks source link

Regression in system tests #80

Closed erikh closed 9 years ago

erikh commented 9 years ago

Seeing this on master as of friday; taking note so I can fix it later: https://gist.github.com/erikh/118796e67335899d3b81

jainvipin commented 9 years ago

@erikh - this is happening because following function is returning improper IP address. Moving to logrus results into the lines being considered one, not multiple therefore the grep doesn't really work on IpAddress field.

func GetIpAddress(t *testing.T, node TestbedNode, ep string) string {
        cmdStr := "netdcli -oper get -construct endpoint " + ep +
                " 2>&1 | grep IpAddress | awk -F : '{gsub(\"[,}{]\",\"\", $2); print $2}'"

Actually the output is that of netdcli i.e.

root@netplugin-node1:/# /opt/golang/bin/netdcli -oper get -construct endpoint orange-myContainer1 
INFO[0000] endpoint State: 
&{CommonState:{StateDriver:0xc208044030,
        Id:orange-myContainer1},
        NetId:orange,
        ContName:myContainer1,
        AttachUUID:,
        IpAddress:11.1.0.1,
        PortName:port1,
        HomingHost:host1,
        IntfName:,
        VtepIp:}

root@netplugin-node1:/# /opt/golang/bin/netdcli -oper get -construct endpoint orange-myContainer1 | grep IpAddress
time="2015-05-25T22:15:45Z" level=info msg="endpoint State: \n&{CommonState:{StateDriver:0xc20803a030,\n\tId:orange-myContainer1},\n\tNetId:orange,\n\tContName:myContainer1,\n\tAttachUUID:,\n\tIpAddress:11.1.0.1,\n\tPortName:port1,\n\tHomingHost:host1,\n\tIntfName:,\n\tVtepIp:}\n" 
erikh commented 9 years ago

Ah ok; I was having a little trouble bootstrapping the netdaemon so I didn’t see any output from -oper get -construct endpoint.

Working on a fix now.

-Erik

On May 25, 2015, at 10:19 PM, Vipin Jain notifications@github.com wrote:

@erikh https://github.com/erikh - this is happening because following function is returning improper IP address. Moving to logrus results into the lines being considered one, not multiple therefore the grep doesn't really work on IpAddress field.

func GetIpAddress(t *testing.T, node TestbedNode, ep string) string { cmdStr := "netdcli -oper get -construct endpoint " + ep + " 2>&1 | grep IpAddress | awk -F : '{gsub(\"[,}{]\",\"\", $2); print $2}'" Actually the output is that of netdcli i.e.

root@netplugin-node1:/# /opt/golang/bin/netdcli -oper get -construct endpoint orange-myContainer1 INFO[0000] endpoint State: &{CommonState:{StateDriver:0xc208044030, Id:orange-myContainer1}, NetId:orange, ContName:myContainer1, AttachUUID:, IpAddress:11.1.0.1, PortName:port1, HomingHost:host1, IntfName:, VtepIp:}

root@netplugin-node1:/# /opt/golang/bin/netdcli -oper get -construct endpoint orange-myContainer1 | grep IpAddress time="2015-05-25T22:15:45Z" level=info msg="endpoint State: \n&{CommonState:{StateDriver:0xc20803a030,\n\tId:orange-myContainer1},\n\tNetId:orange,\n\tContName:myContainer1,\n\tAttachUUID:,\n\tIpAddress:11.1.0.1,\n\tPortName:port1,\n\tHomingHost:host1,\n\tIntfName:,\n\tVtepIp:}\n" — Reply to this email directly or view it on GitHub https://github.com/contiv/netplugin/issues/80#issuecomment-105396652.