Correct all RSD 2.1 files format
Change-Id: I078c9422ec3782b771ac2bb14626a70ca15a3438
This commit is contained in:
parent
a5a4ef9c83
commit
0d79c5eaa1
@ -187,7 +187,6 @@ class EthernetSwitchPort(rsd_lib_base.ResourceBase):
|
||||
|
||||
|
||||
class EthernetSwitchPortCollection(rsd_lib_base.ResourceCollectionBase):
|
||||
|
||||
@property
|
||||
def _resource_type(self):
|
||||
return EthernetSwitchPort
|
||||
|
@ -55,9 +55,7 @@ class EthernetSwitchStaticMAC(rsd_lib_base.ResourceBase):
|
||||
if vlan_id is not None:
|
||||
if not isinstance(vlan_id, int):
|
||||
raise exceptions.InvalidParameterValueError(
|
||||
parameter="vlan_id",
|
||||
value=vlan_id,
|
||||
valid_values="int",
|
||||
parameter="vlan_id", value=vlan_id, valid_values="int"
|
||||
)
|
||||
data["VLANId"] = vlan_id
|
||||
|
||||
@ -69,7 +67,6 @@ class EthernetSwitchStaticMAC(rsd_lib_base.ResourceBase):
|
||||
|
||||
|
||||
class EthernetSwitchStaticMACCollection(rsd_lib_base.ResourceCollectionBase):
|
||||
|
||||
@property
|
||||
def _resource_type(self):
|
||||
return EthernetSwitchStaticMAC
|
||||
|
@ -145,18 +145,9 @@ port_req_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"PortId": {"type": "number"},
|
||||
"LinkType": {
|
||||
"type": "string",
|
||||
"enum": ["Ethernet", "PCIe"],
|
||||
},
|
||||
"OperationalState": {
|
||||
"type": "string",
|
||||
"enum": ["Up", "Down"],
|
||||
},
|
||||
"AdministrativeState": {
|
||||
"type": "string",
|
||||
"enum": ["Up", "Down"],
|
||||
},
|
||||
"LinkType": {"type": "string", "enum": ["Ethernet", "PCIe"]},
|
||||
"OperationalState": {"type": "string", "enum": ["Up", "Down"]},
|
||||
"AdministrativeState": {"type": "string", "enum": ["Up", "Down"]},
|
||||
"LinkSpeedMbps": {"type": ["number", "null"]},
|
||||
"NeighborInfo": {
|
||||
"type": "object",
|
||||
|
@ -189,9 +189,7 @@ class TestChassis(base.TestCase):
|
||||
def test_power(self):
|
||||
# | GIVEN |
|
||||
self.conn.get.return_value.json.reset_mock()
|
||||
with open(
|
||||
"rsd_lib/tests/unit/json_samples/v2_1/power.json", "r"
|
||||
) as f:
|
||||
with open("rsd_lib/tests/unit/json_samples/v2_1/power.json", "r") as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN |
|
||||
actual_power = self.chassis_inst.power
|
||||
@ -208,9 +206,7 @@ class TestChassis(base.TestCase):
|
||||
|
||||
def test_power_on_refresh(self):
|
||||
# | GIVEN |
|
||||
with open(
|
||||
"rsd_lib/tests/unit/json_samples/v2_1/power.json", "r"
|
||||
) as f:
|
||||
with open("rsd_lib/tests/unit/json_samples/v2_1/power.json", "r") as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(self.chassis_inst.power, power.Power)
|
||||
@ -225,9 +221,7 @@ class TestChassis(base.TestCase):
|
||||
self.chassis_inst.refresh(force=False)
|
||||
|
||||
# | GIVEN |
|
||||
with open(
|
||||
"rsd_lib/tests/unit/json_samples/v2_1/power.json", "r"
|
||||
) as f:
|
||||
with open("rsd_lib/tests/unit/json_samples/v2_1/power.json", "r") as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(self.chassis_inst.power, power.Power)
|
||||
|
@ -87,7 +87,7 @@ class EthernetSwitchACLTestCase(testtools.TestCase):
|
||||
data={
|
||||
"Port": {
|
||||
"@odata.id": "/redfish/v1/EthernetSwitches/Switch1/Ports/"
|
||||
"sw0p2"
|
||||
"sw0p2"
|
||||
}
|
||||
},
|
||||
)
|
||||
@ -127,7 +127,7 @@ class EthernetSwitchACLTestCase(testtools.TestCase):
|
||||
data={
|
||||
"Port": {
|
||||
"@odata.id": "/redfish/v1/EthernetSwitches/Switch1/Ports/"
|
||||
"sw0p1"
|
||||
"sw0p1"
|
||||
}
|
||||
},
|
||||
)
|
||||
@ -220,7 +220,7 @@ class EthernetSwitchACLCollectionTestCase(testtools.TestCase):
|
||||
None,
|
||||
headers={
|
||||
"Location": "https://localhost:8443/redfish/v1/"
|
||||
"EthernetSwitches/Switch1/ACLs/ACL1"
|
||||
"EthernetSwitches/Switch1/ACLs/ACL1"
|
||||
},
|
||||
)
|
||||
self.acl_col = ethernet_switch_acl.EthernetSwitchACLCollection(
|
||||
@ -265,9 +265,8 @@ class EthernetSwitchACLCollectionTestCase(testtools.TestCase):
|
||||
def test_create_acl(self):
|
||||
result = self.acl_col.create_acl()
|
||||
self.acl_col._conn.post.assert_called_once_with(
|
||||
"/redfish/v1/EthernetSwitches/Switch1/ACLs", data={},
|
||||
"/redfish/v1/EthernetSwitches/Switch1/ACLs", data={}
|
||||
)
|
||||
self.assertEqual(
|
||||
result,
|
||||
"/redfish/v1/EthernetSwitches/Switch1/ACLs/ACL1",
|
||||
result, "/redfish/v1/EthernetSwitches/Switch1/ACLs/ACL1"
|
||||
)
|
||||
|
@ -151,9 +151,7 @@ class EthernetSwitchACLRuleTestCase(testtools.TestCase):
|
||||
) as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN |
|
||||
actual_mirror_port_region = (
|
||||
self.acl_rule_inst.mirror_port_region
|
||||
)
|
||||
actual_mirror_port_region = self.acl_rule_inst.mirror_port_region
|
||||
# | THEN |
|
||||
self.assertIsInstance(actual_mirror_port_region, list)
|
||||
self.conn.get.return_value.json.assert_called_with()
|
||||
@ -163,8 +161,7 @@ class EthernetSwitchACLRuleTestCase(testtools.TestCase):
|
||||
# | WHEN & THEN |
|
||||
# tests for same object on invoking subsequently
|
||||
self.assertIs(
|
||||
actual_mirror_port_region,
|
||||
self.acl_rule_inst.mirror_port_region,
|
||||
actual_mirror_port_region, self.acl_rule_inst.mirror_port_region
|
||||
)
|
||||
self.conn.get.return_value.json.assert_not_called()
|
||||
|
||||
@ -202,10 +199,7 @@ class EthernetSwitchACLRuleTestCase(testtools.TestCase):
|
||||
"RuleId": 1,
|
||||
"Action": "Permit",
|
||||
"Condition": {
|
||||
"IPSource": {
|
||||
"IPv4Address": "192.168.6.0",
|
||||
"Mask": "0.0.0.255",
|
||||
},
|
||||
"IPSource": {"IPv4Address": "192.168.6.0", "Mask": "0.0.0.255"}
|
||||
},
|
||||
}
|
||||
self.acl_rule_inst.update(data)
|
||||
|
@ -252,17 +252,20 @@ class EthernetSwitchPortTestCase(testtools.TestCase):
|
||||
"Switch1/Ports/Port11/VLans/VLan1"
|
||||
},
|
||||
"PortMembers": [
|
||||
{"@odata.id": "/redfish/v1/EthernetSwitches/"
|
||||
"Switch1/Ports/Port10"},
|
||||
{"@odata.id": "/redfish/v1/EthernetSwitches/"
|
||||
"Switch1/Ports/Port12"},
|
||||
{
|
||||
"@odata.id": "/redfish/v1/EthernetSwitches/"
|
||||
"Switch1/Ports/Port10"
|
||||
},
|
||||
{
|
||||
"@odata.id": "/redfish/v1/EthernetSwitches/"
|
||||
"Switch1/Ports/Port12"
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
self.port_inst.update(data)
|
||||
self.port_inst._conn.patch.assert_called_once_with(
|
||||
"/redfish/v1/EthernetSwitches/Switch1/Ports/Port1",
|
||||
data=data,
|
||||
"/redfish/v1/EthernetSwitches/Switch1/Ports/Port1", data=data
|
||||
)
|
||||
|
||||
|
||||
@ -330,11 +333,15 @@ class EthernetSwitchPortCollectionTestCase(testtools.TestCase):
|
||||
"PortMode": "LinkAggregationStatic",
|
||||
"Links": {
|
||||
"PortMembers": [
|
||||
{"@odata.id": "/redfish/v1/EthernetSwitches/"
|
||||
"Switch1/Ports/Port10"},
|
||||
{"@odata.id": "/redfish/v1/EthernetSwitches/"
|
||||
"Switch1/Ports/Port11"},
|
||||
],
|
||||
{
|
||||
"@odata.id": "/redfish/v1/EthernetSwitches/"
|
||||
"Switch1/Ports/Port10"
|
||||
},
|
||||
{
|
||||
"@odata.id": "/redfish/v1/EthernetSwitches/"
|
||||
"Switch1/Ports/Port11"
|
||||
},
|
||||
]
|
||||
},
|
||||
}
|
||||
result = self.port_col.create_port(reqs)
|
||||
@ -342,6 +349,5 @@ class EthernetSwitchPortCollectionTestCase(testtools.TestCase):
|
||||
"/redfish/v1/EthernetSwitches/Switch1/Ports", data=reqs
|
||||
)
|
||||
self.assertEqual(
|
||||
result,
|
||||
"/redfish/v1/EthernetSwitches/Switch1/Ports/Port1",
|
||||
result, "/redfish/v1/EthernetSwitches/Switch1/Ports/Port1"
|
||||
)
|
||||
|
@ -63,9 +63,7 @@ class EthernetSwitchStaticMACTestCase(testtools.TestCase):
|
||||
|
||||
self.static_mac_inst._conn.patch.reset_mock()
|
||||
reqs = {"MACAddress": "00:11:22:33:44:55", "VLANId": 69}
|
||||
self.static_mac_inst.update(
|
||||
"00:11:22:33:44:55", vlan_id=69
|
||||
)
|
||||
self.static_mac_inst.update("00:11:22:33:44:55", vlan_id=69)
|
||||
self.static_mac_inst._conn.patch.assert_called_once_with(
|
||||
"/redfish/v1/EthernetSwitches/Switch1/Ports/StaticMACs/1",
|
||||
data=reqs,
|
||||
|
@ -159,7 +159,7 @@ class DriveTestCase(testtools.TestCase):
|
||||
with self.assertRaisesRegex(
|
||||
exceptions.InvalidParameterValueError,
|
||||
'The parameter "erase_on_detach" value "invalid string" is '
|
||||
'invalid',
|
||||
"invalid",
|
||||
):
|
||||
self.drive_inst.update(erase_on_detach="invalid string")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user