openbmc / openbmc-test-automation

Apache License 2.0
101 stars 92 forks source link

[Automation] Setting Mac address using REST - HTTP_UNAUTHORIZED Response #107

Closed gkeishin closed 7 years ago

gkeishin commented 8 years ago

Looks like this REST method is restricted or not allowed via REST for setting MAC value

The interface /org/openbmc/NetworkManager/Interface//action/SetHwAddress request results in HTTPS 401 response which means HTTP_UNAUTHORIZED

So this needs to confirm with the development if this method is valid or not. If so why this 401

GOOD PATH This test case add the ip address on the interface and validates that ip address has been added or not. Expectation is the ip address should get added.

Documentation:

Send a POST request on the session object found using the Start / End / Elapsed: 20160913 10:50:42.478 / 20160913 10:50:51.358 / 00:00:08.880 10:50:51.358 INFO Post Request using : alias=openbmc, uri=/org/openbmc/NetworkManager/Interface//action/SetHwAddress, data={"data": ["eth0", "00:01:6c:80:02:78"]}, headers={u'Content-Type': u'application/json'}, files=None, allow_redirects=True
10:50:51.358 INFO ${ret} = Response [401]

Two network test cases are failing Set and revert mac value

gwshan commented 8 years ago

I think the networking will be unavailable after configuring the interface with a different MAC address. It's a known issue in NCSI stack. The new MAC address isn't configured to the filter in time, meaning the BRT won't forward incoming frames whose destination MAC is the newly configured one to BMC accordingly. As we have different (NCSI) code in 4.4/5/6 and 4.7, could you please claim which release the issue was reported from?

gkeishin commented 8 years ago

@gwshan The driver info

root@barreleye:~# cat /etc/version 20160913033422 root@barreleye:~# cat /etc/os-release ID="openbmc-phosphor" NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro)" VERSION="v1.99.0-60" VERSION_ID="v1.99.0-60-g2b717d8-dirty" PRETTY_NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) v1.99.0-60" BUILD_ID="v1.99.0"

gkeishin commented 8 years ago

@gwshan From today build as well same error

Set valid Mac address :: _GOOD PATH_ URI:https://9.3.29.119/org/openbmc/NetworkManager/Interface//action/SetHwAddress, method:Post, args:{u'data': {u'data': [u'eth0', u'00:21:cc:73:91:dd']}, u'headers': {u'Content-Type': u'application/json'}} Response code:401, Content:{ "data": { "description": "Login required" }, "message": "401 Unauthorized", "status": "error" } F FFDC Collection Started : 20160913230959974789 FFDC Collection Completed : 20160913231034179346 Set valid Mac address :: _GOOD PATH_ | FAIL |

401 != 200

Revert old Mac address :: _GOOD PATH_ URI:https://9.3.29.119/org/openbmc/NetworkManager/Interface//action/SetHwAddress, method:Post, args:{u'data': {u'data': [u'eth0', u'00:01:6c:80:02:78']}, u'headers': {u'Content-Type': u'application/json'}} Response code:401, Content:{ "data": { "description": "Login required" }, "message": "401 Unauthorized", "status": "error" } F FFDC Collection Started : 20160913231047281718 FFDC Collection Completed : 20160913231122420709 Revert old Mac address :: _GOOD PATH_ | FAIL |

401 != 200

root@barreleye:~# cat /etc/version 20160913205350 root@barreleye:~# cat /etc/os-release ID="openbmc-phosphor" NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro)" VERSION="v1.99.0-75" VERSION_ID="v1.99.0-75-gc36e20e-dirty" PRETTY_NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) v1.99.0-75" BUILD_ID="v1.99.0" root@barreleye:~#

Build Name: #239-c36e20e583d937 Build Number: 239


Build Info:

Build #239-c36e20e583d937 (Sep 13, 2016 8:48:46 PM)

Build Change info:

Changes Git (git https://github.com/openbmc/openbmc.git) network: add missing systemd dep (commit: c36e20e) (detail) Started by GitHub push by williamspatrick Revision: c36e20e583d937052a0564794fa7f8e6be3264a7

refs/remotes/origin/master

gkeishin commented 8 years ago

@gwshan Anything we need to know more on this... ? or is this some special mode we have to be in to access this method to set the MAC HW address..

mdmillerii commented 8 years ago

The error 401 Unauthorized says the REST server rejected the attempt.

I doubt it is a mapping back from the kernel. I doubt this has anything to do with timings in the NCSI stack. I expect the code to change the MAC is never executed.

gkeishin commented 8 years ago

ah okie.. From Journald i see message log like this

Sep 08 21:50:36 barreleye phosphor-gevent[974]:xx.xx.xx.xx - - [2016-09-08 21:50:36] "POST /org/openbmc/NetworkManager/Interface//action/SetAddress4 HTTP/1.1" 401 230 0.187601

mdmillerii commented 8 years ago

Please check the automation, the most likely cause is an error with the login request or failing to pass the authorization cookie.

gkeishin commented 8 years ago

@mdmillerii Just reran the test, the login request went fine.. but the next operation to set failed as reported

method:Post, args:{u'data': {u'data': [u'eth0', u'00:21:cc:73:91:dd']}, u'headers': {u'Content-Type': u'application/json'}} Response code:401, Content:{ "data": { "description": "Login required" }, "message": "401 Unauthorized", "status": "error" }

Send a POST request on the session object found using the Start / End / Elapsed: 20160919 07:22:34.279 / 20160919 07:22:36.402 / 00:00:02.123 07:22:36.401 INFO Post Request using : alias=openbmc, uri=/login, data={"data": ["root", "0penBmc"]}, headers={u'Content-Type': u'application/json'}, files=None, allow_redirects=True
07:22:36.402 INFO ${resp} = Response [200]

Send a POST request on the session object found using the Start / End / Elapsed: 20160919 07:22:36.405 / 20160919 07:22:47.303 / 00:00:10.898 07:22:47.303 INFO Post Request using : alias=openbmc, uri=/org/openbmc/NetworkManager/Interface//action/SetHwAddress, data={"data": ["eth0", "00:21:cc:73:91:dd"]}, headers={u'Content-Type': u'application/json'}, files=None, allow_redirects=True
07:22:47.303 INFO ${ret} = Response [401]

gwshan commented 8 years ago

I already had the patch allowing to run below commands. I will post them together with other NCSI patches at appropriate time:

bmc# ifconfig eth0 down bmc# Ifconfig eth0 hw ether A0:42:3F:2D:08:7E bmc# ifconfig eth0 up bmc# # ifconfig eth0 Link encap:Ethernet HWaddr A0:42:3F:2D:08:7E
inet addr:10.61.161.105 Bcast:10.61.255.255 Mask:255.255.0.0 inet6 addr: fe80::a242:3fff:fe2d:87e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:955 errors:0 dropped:0 overruns:0 frame:0 TX packets:367 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:51235 (50.0 KiB) TX bytes:23430 (22.8 KiB)

gwshan@gwshan:~$ sudo arp grep "a0:42:3f:2d:08:7e" gwshan@gwshan:~$ sudo ping -c 1 10.61.161.105 PING 10.61.161.105 (10.61.161.105) 56(84) bytes of data. 64 bytes from 10.61.161.105: icmp_seq=1 ttl=64 time=1.62 ms
gwshan@gwshan:~$ sudo arp grep "a0:42:3f:2d:08:7e"

palm8-bmc.ozlabs.ibm.co ether a0:42:3f:2d:08:7e C eth0

gkeishin commented 7 years ago

@gwshan That's cool.. is changes this one going in soon :)

sivassrr commented 7 years ago

@gkeishin Dear George, Are we still seeing this issue?

gkeishin commented 7 years ago

@sivassrr This is now in extended use case.. and we haven't tested it yet. On top of that the networking test case for MAC are needed to be updated as discussed earlier..

gkeishin commented 7 years ago

@prkatti1 Can you take a look into this Network test

sivassrr commented 7 years ago

@prkatti1 As discussed, Please test using official release driver of all our network TCs and update it accordingly.

gkeishin commented 7 years ago

Closing this as the new network refactor code is coming in.