Optimization and response status code update

In following test files response status code is not being checked -
1. test_api_discovery.py
2. test_chassis.py
3. test_nodes.py
4. test_ports.py

This patch adds checking for missing response status code in above.
Also it optimize codes of files.
Change-Id: I4bc5aa756508b533919c283ce18f641fec50b30e
Merge "Optimization and response status code update"