public void UpdateSubnetTest() { var os = new OpenStackMember(UserName, Password, TenantName, TenantId); // create network string network_name = GetTesterNameByEnv(); bool adminStateUp = true; string networkType = "vxlan"; string segmentationId = null; var n = os.CreateNetwork(network_name, adminStateUp, networkType, segmentationId); Assert.IsNotNull(n); try { string subnet_name = GetTesterNameByEnv(); int ipVersion = 4; string cidr = "192.168.2.0/24"; // create subnet var s = os.CreateSubnet(subnet_name, n.Id, ipVersion, cidr); Assert.IsNotNull(s); Trace.WriteLine(string.Format("subnet IpVersion : {0}", s.IpVersion)); try { // update subnet var subnet = os.UpdateSubnet(s.Id, "new value"); Assert.IsNotNull(subnet); Trace.WriteLine(string.Format("subnet name : {0}", subnet.Name)); // this fails //subnet = os.UpdateSubnet(s.Id, "日本語"); //subnet = os.UpdateSubnet(s.Id, "new value\\\""); } finally { Assert.IsTrue(os.DeleteSubnet(s.Id)); } } finally { Assert.IsTrue(os.DeleteNetwork(n.Id)); } }
public void CreateSubnetTest() { var os = new OpenStackMember(UserName, Password, TenantName, TenantId); // create network string network_name = GetTesterNameByEnv(); bool adminStateUp = true; string networkType = "vxlan"; string segmentationId = null; var n = os.CreateNetwork(network_name, adminStateUp, networkType, segmentationId); Assert.IsNotNull(n); try { // create subnet string subnet_name = GetTesterNameByEnv(); int ipVersion = 4; string cidr = "192.168.2.0/24"; var s = os.CreateSubnet(subnet_name, n.Id, ipVersion, cidr); Assert.IsNotNull(s); Trace.WriteLine(string.Format("subnet Id : {0}", s.Id)); Trace.WriteLine(string.Format("subnet Name : {0}", s.Name)); Trace.WriteLine(string.Format("subnet TenantId : {0}", s.TenantId)); Trace.WriteLine(string.Format("subnet NetworkId : {0}", s.NetworkId)); Trace.WriteLine(string.Format("subnet Cidr : {0}", s.Cidr)); Trace.WriteLine(string.Format("subnet GatewayIp : {0}", s.GatewayIp)); Trace.WriteLine(string.Format("subnet IpVersion : {0}", s.IpVersion)); Assert.IsTrue(os.DeleteSubnet(s.Id)); } finally { Assert.IsTrue(os.DeleteNetwork(n.Id)); } }