Revision 82a8bf3e qa/rapi-workload.py
b/qa/rapi-workload.py | ||
---|---|---|
516 | 516 |
Finish(client, client.DeleteGroup, TEST_GROUP_NAME) |
517 | 517 |
|
518 | 518 |
|
519 |
def TestNetworkConnectDisconnect(client, network_name, mode, link): |
|
520 |
""" Test connecting and disconnecting the network to a new node group. |
|
521 |
|
|
522 |
@type network_name string |
|
523 |
@param network_name The name of an existing and unconnected network. |
|
524 |
@type mode string |
|
525 |
@param mode The network mode. |
|
526 |
@type link string |
|
527 |
@param link The network link. |
|
528 |
|
|
529 |
""" |
|
530 |
# For testing the connect/disconnect calls, a group is needed |
|
531 |
TEST_GROUP_NAME = "TestGroup" |
|
532 |
Finish(client, client.CreateGroup, |
|
533 |
TEST_GROUP_NAME, alloc_policy=constants.ALLOC_POLICY_PREFERRED) |
|
534 |
|
|
535 |
Finish(client, client.ConnectNetwork, |
|
536 |
network_name, TEST_GROUP_NAME, mode, link, dry_run=True) |
|
537 |
|
|
538 |
Finish(client, client.ConnectNetwork, |
|
539 |
network_name, TEST_GROUP_NAME, mode, link) |
|
540 |
|
|
541 |
Finish(client, client.DisconnectNetwork, |
|
542 |
network_name, TEST_GROUP_NAME, dry_run=True) |
|
543 |
|
|
544 |
Finish(client, client.DisconnectNetwork, |
|
545 |
network_name, TEST_GROUP_NAME) |
|
546 |
|
|
547 |
# Clean up the group |
|
548 |
Finish(client, client.DeleteGroup, TEST_GROUP_NAME) |
|
549 |
|
|
550 |
|
|
551 |
def TestNetworks(client): |
|
552 |
""" Add some networks of different sizes, using RFC5737 addresses like in the |
|
553 |
QA. |
|
554 |
|
|
555 |
""" |
|
556 |
|
|
557 |
NETWORK_NAME = "SurelyCertainlyNonexistentNetwork" |
|
558 |
|
|
559 |
Finish(client, client.CreateNetwork, |
|
560 |
NETWORK_NAME, "192.0.2.0/30", tags=[], dry_run=True) |
|
561 |
|
|
562 |
Finish(client, client.CreateNetwork, |
|
563 |
NETWORK_NAME, "192.0.2.0/30", tags=[]) |
|
564 |
|
|
565 |
client.GetNetwork(NETWORK_NAME) |
|
566 |
|
|
567 |
TestTags(client, client.GetNetworkTags, client.AddNetworkTags, |
|
568 |
client.DeleteNetworkTags, NETWORK_NAME) |
|
569 |
|
|
570 |
Finish(client, client.ModifyNetwork, |
|
571 |
NETWORK_NAME, mac_prefix=None) |
|
572 |
|
|
573 |
TestQueries(client, "network") |
|
574 |
|
|
575 |
default_nicparams = qa_config.get("default-nicparams", None) |
|
576 |
|
|
577 |
# The entry might not be present in the QA config |
|
578 |
if default_nicparams is not None: |
|
579 |
mode = default_nicparams.get("mode", None) |
|
580 |
link = default_nicparams.get("link", None) |
|
581 |
if mode is not None and link is not None: |
|
582 |
TestNetworkConnectDisconnect(client, NETWORK_NAME, mode, link) |
|
583 |
|
|
584 |
# Clean up the network |
|
585 |
Finish(client, client.DeleteNetwork, |
|
586 |
NETWORK_NAME, dry_run=True) |
|
587 |
|
|
588 |
Finish(client, client.DeleteNetwork, NETWORK_NAME) |
|
589 |
|
|
590 |
|
|
519 | 591 |
def Workload(client): |
520 | 592 |
""" The actual RAPI workload used for tests. |
521 | 593 |
|
... | ... | |
563 | 635 |
TestNodeOperations(client, node.primary) |
564 | 636 |
TestQueryFiltering(client, node.primary) |
565 | 637 |
node.Release() |
566 |
|
|
638 |
|
|
567 | 639 |
nodes = qa_config.AcquireManyNodes(2) |
568 | 640 |
TestGroupOperations(client, nodes[0].primary, nodes[1].primary) |
569 | 641 |
qa_config.ReleaseManyNodes(nodes) |
570 | 642 |
|
643 |
TestNetworks(client) |
|
644 |
|
|
571 | 645 |
|
572 | 646 |
def Usage(): |
573 | 647 |
sys.stderr.write("Usage:\n\trapi-workload.py qa-config-file") |
Also available in: Unified diff