LGTM, thanks On Dec 20, 2013 2:59 PM, "Hrvoje Ribicic" <[email protected]> wrote:
> On Fri, Dec 20, 2013 at 11:30 AM, Helga Velroyen <[email protected]>wrote: > >> >> >> >> On Fri, Dec 20, 2013 at 10:09 AM, Hrvoje Ribicic <[email protected]> wrote: >> >>> This patch exercises the network RAPI commands. Due to the fact that >>> these seem to have a few errors, this patch will have to be altered >>> later. >>> >> >> Are the errors filed as bugs? >> > > They were, and the bugs were fixed on 2.8. > By this point the fixes should have propagated to master, so the patch > description is probably inaccurate. > > >> >> >>> >>> Signed-off-by: Hrvoje Ribicic <[email protected]> >>> --- >>> qa/rapi-workload.py | 76 >>> ++++++++++++++++++++++++++++++++++++++++++++++++++++- >>> 1 file changed, 75 insertions(+), 1 deletion(-) >>> >>> diff --git a/qa/rapi-workload.py b/qa/rapi-workload.py >>> index dbbc8a8..b71d268 100755 >>> --- a/qa/rapi-workload.py >>> +++ b/qa/rapi-workload.py >>> @@ -513,6 +513,78 @@ def TestGroupOperations(client, node, another_node): >>> Finish(client, client.DeleteGroup, TEST_GROUP_NAME) >>> >>> >>> +def TestNetworkConnectDisconnect(client, network_name, mode, link): >>> + """ Test connecting and disconnecting the network to a new node group. >>> + >>> + @type network_name string >>> + @param network_name The name of an existing and unconnected network. >>> + @type mode string >>> + @param mode The network mode. >>> + @type link string >>> + @param link The network link. >>> >> >> colons! :) >> >> > > Colons! Will be fixed in patch coming later. > > >> + >>> + """ >>> + # For testing the connect/disconnect calls, a group is needed >>> + TEST_GROUP_NAME = "TestGroup" >>> + Finish(client, client.CreateGroup, >>> + TEST_GROUP_NAME, alloc_policy=constants.ALLOC_POLICY_PREFERRED) >>> + >>> + Finish(client, client.ConnectNetwork, >>> + network_name, TEST_GROUP_NAME, mode, link, dry_run=True) >>> + >>> + Finish(client, client.ConnectNetwork, >>> + network_name, TEST_GROUP_NAME, mode, link) >>> + >>> + Finish(client, client.DisconnectNetwork, >>> + network_name, TEST_GROUP_NAME, dry_run=True) >>> + >>> + Finish(client, client.DisconnectNetwork, >>> + network_name, TEST_GROUP_NAME) >>> + >>> + # Clean up the group >>> + Finish(client, client.DeleteGroup, TEST_GROUP_NAME) >>> + >>> + >>> +def TestNetworks(client): >>> + """ Add some networks of different sizes, using RFC5737 addresses >>> like in the >>> + QA. >>> + >>> + """ >>> + >>> + NETWORK_NAME = "SurelyCertainlyNonexistentNetwork" >>> + >>> + Finish(client, client.CreateNetwork, >>> + NETWORK_NAME, "192.0.2.0/30", tags=[], dry_run=True) >>> + >>> + Finish(client, client.CreateNetwork, >>> + NETWORK_NAME, "192.0.2.0/30", tags=[]) >>> + >>> + client.GetNetwork(NETWORK_NAME) >>> + >>> + TestTags(client, client.GetNetworkTags, client.AddNetworkTags, >>> + client.DeleteNetworkTags, NETWORK_NAME) >>> + >>> + Finish(client, client.ModifyNetwork, >>> + NETWORK_NAME, mac_prefix=None) >>> + >>> + TestQueries(client, "network") >>> + >>> + default_nicparams = qa_config.get("default-nicparams", None) >>> + >>> + # The entry might not be present in the QA config >>> + if default_nicparams is not None: >>> + mode = default_nicparams.get("mode", None) >>> + link = default_nicparams.get("link", None) >>> + if mode is not None and link is not None: >>> + TestNetworkConnectDisconnect(client, NETWORK_NAME, mode, link) >>> + >>> + # Clean up the network >>> + Finish(client, client.DeleteNetwork, >>> + NETWORK_NAME, dry_run=True) >>> + >>> + Finish(client, client.DeleteNetwork, NETWORK_NAME) >>> + >>> + >>> def Workload(client): >>> """ The actual RAPI workload used for tests. >>> >>> @@ -560,11 +632,13 @@ def Workload(client): >>> TestNodeOperations(client, node.primary) >>> TestQueryFiltering(client, node.primary) >>> node.Release() >>> - >>> + >>> nodes = qa_config.AcquireManyNodes(2) >>> TestGroupOperations(client, nodes[0].primary, nodes[1].primary) >>> qa_config.ReleaseManyNodes(nodes) >>> >>> + TestNetworks(client) >>> + >>> >>> def Usage(): >>> sys.stderr.write("Usage:\n\trapi-workload.py qa-config-file") >>> -- >>> 1.8.5.1 >>> >>> >> >> LGTM, thanks >> >> -- >> -- >> Helga Velroyen | Software Engineer | [email protected] | >> >> Google Germany GmbH >> Dienerstr. 12 >> 80331 München >> >> Registergericht und -nummer: Hamburg, HRB 86891 >> Sitz der Gesellschaft: Hamburg >> Geschäftsführer: Graham Law, Christine Elizabeth Flores >> > > New, more boring, patch message: > > Add network workload > > This patch exercises the network RAPI commands. >
