@Test(description = "PUT /admin/network/{id}" )
public void testEditNetwork() {
//TODO: ensure network instanceof OrgNetwork, may require queries
assertTrue(network instanceof OrgNetwork, String.format(URN_REQ_LIVE, "OrgNetwork"));
OrgNetwork oldNetwork = Network.<OrgNetwork>toSubType(network)
.toBuilder()
.tasks(ImmutableSet.<Task>of())
.build();
OrgNetwork editNetwork = getMutatedOrgNetwork(oldNetwork);
try {
Task editNetworkTask = networkApi.edit(networkUrn, editNetwork);
Checks.checkTask(editNetworkTask);
assertTrue(retryTaskSuccess.apply(editNetworkTask), String.format(TASK_COMPLETE_TIMELY, "editNetworkTask"));
network = networkApi.get(networkUrn);
Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network));
assertTrue(equal(network.getConfiguration().getIpScope(),
editNetwork.getConfiguration().getIpScope()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK + ".configuration", "ipScope"));
assertTrue(equal(network.getConfiguration().getParentNetwork(),
editNetwork.getConfiguration().getParentNetwork()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK + ".configuration", "parentNetwork"));
assertTrue(equal(network.getConfiguration().getFenceMode(),
editNetwork.getConfiguration().getFenceMode()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK + ".configuration", "fenceMode"));
assertTrue(equal(network.getConfiguration().retainNetInfoAcrossDeployments(),
editNetwork.getConfiguration().retainNetInfoAcrossDeployments()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK + ".configuration", "retainNetInfoAcrossDeployments"));
assertTrue(equal(network.getConfiguration().getNetworkFeatures(),
editNetwork.getConfiguration().getNetworkFeatures()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK + ".configuration", "networkFeatures"));
assertTrue(equal(network.getConfiguration().getSyslogServerSettings(),
editNetwork.getConfiguration().getSyslogServerSettings()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK + ".configuration", "syslogServerSettings"));
assertTrue(equal(network.getConfiguration().getRouterInfo(),
editNetwork.getConfiguration().getRouterInfo()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK + ".configuration", "routerInfo"));
// FIXME: fails
// assertTrue(equal(Network.<OrgNetwork>toSubType(network).getNetworkPool(),
// editNetwork.getNetworkPool()),
// String.format(OBJ_FIELD_UPDATABLE, NETWORK, "networkPool"));