def test_get_port_stats_invalid_lswitch(self): try: nvplib.get_port_stats(self.quantum.controller, "invalid-lswitch", "invalid-port") except exception.NetworkNotFound: return # Shouldn't be reached self.assertTrue(False)
def test_get_port_stats_invalid_port(self): resp = self.quantum.create_custom_network("quantum-test-tenant", "quantum-Private-TenantA", self.BRIDGE_TZ_UUID, self.quantum.controller) net_id = resp["net-id"] self.networks.append(net_id) try: nvplib.get_port_stats(self.quantum.controller, net_id, "invalid-port") except exception.PortNotFound: return # Shouldn't be reached self.assertTrue(False)
def test_get_port_stats_returns_the_right_stuff(self): resp = self.quantum.create_custom_network("quantum-test-tenant", "quantum-Private-TenantA", self.BRIDGE_TZ_UUID, self.quantum.controller) net_id = resp["net-id"] self.networks.append(net_id) resp = self.quantum.create_port("quantum-test-tenant", net_id, "ACTIVE") port_id = resp["port-id"] self.ports.append((net_id, port_id)) res = nvplib.get_port_stats(self.quantum.controller, net_id, port_id) self.assertTrue("tx_errors" in res) self.assertTrue("tx_bytes" in res) self.assertTrue("tx_packets" in res) self.assertTrue("rx_errors" in res) self.assertTrue("rx_bytes" in res) self.assertTrue("rx_packets" in res)