Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2013-2014 Dell, Inc ==================================================================== Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ====================================================================
  
  
  package org.dasein.cloud.azure.network;
  
  
  import java.util.HashMap;
  import java.util.Locale;
  
  import  javax.annotation.Nonnull;
  import  javax.annotation.Nullable;
  
  import org.w3c.dom.Node;
  
  public class AzureVlanSupport extends AbstractVLANSupport {
      static private final Logger logger = Azure.getLogger(AzureVlanSupport.class);
  
  	
  	static private final String NETWORKING_SERVICES = "/services/networking";
  
      private Azure provider;
  
      public AzureVlanSupport(Azure provider) {
          super(provider);
          this. = provider;
      }
  	
  
  	public String[] mapServiceAction(ServiceAction action) {
  		return new String[0];
  	}
  
  	public void assignRoutingTableToSubnet(String subnetId,String routingTableIdthrows CloudExceptionInternalException {
          throw new OperationNotSupportedException("Routing tables not supported");
  
  	}
  
  	public void assignRoutingTableToVlan(String vlanIdString routingTableId)
          throw new OperationNotSupportedException("Routing tables not supported");
  
 	}
 
 	public void attachNetworkInterface(String nicIdString vmIdint index)
         throw new OperationNotSupportedException("Network interfaces not supported");
 
 	}
 
 	public String createInternetGateway(String forVlanId)
         throw new OperationNotSupportedException("Internet gateways not supported");
 	}
 
 	public String createRoutingTable(String forVlanIdString name,
 			String descriptionthrows CloudExceptionInternalException {
         throw new OperationNotSupportedException("Routing tables not supported");
 	}
 
         throw new OperationNotSupportedException("Network interfaces not supported");
 	}
 
     @Nonnull
     @Override
     public Subnet createSubnet(@Nonnull SubnetCreateOptions subnetCreateOptionsthrows CloudExceptionInternalException {
         if.isTraceEnabled() ) {
             .trace("ENTER: " + AzureVlanSupport.class.getName() + ".createSubnet()");
         }
 
         try {
             ProviderContext ctx = .getContext();
 
             ifctx == null ) {
                 throw new AzureConfigException("No context was specified for this request");
             }
 
             String vlanId = subnetCreateOptions.getProviderVlanId();
             VLAN vlan = getVlan(vlanId);
             String vlanName = vlan.getName();
 
             String subName = subnetCreateOptions.getName();
             String subCidr = subnetCreateOptions.getCidr();
 
             AzureMethod method = new AzureMethod();
             StringBuilder xml = new StringBuilder();
 
             Document doc = getNetworkConfig();
             NodeList entries = doc.getElementsByTagName("VirtualNetworkConfiguration");
 
             for (int i = 0; i < entries.getLength(); i++) {
                 Node node = entries.item(i);
 
                 Element element = (Elementnode;
 
                 NodeList virtualNetworkSites = element.getElementsByTagName("VirtualNetworkSites");
                 for (int j = 0; j<virtualNetworkSites.getLength(); j++) {
                     Node item = virtualNetworkSites.item(j);
 
                     if(item.getNodeType() == .continue;
 
                     Element elItem = (Elementitem;
                     NodeList vns = elItem.getElementsByTagName("VirtualNetworkSite");
                     for (int k = 0; k<vns.getLength(); k++) {
                         Node vn = vns.item(k);
                         String vnName = vn.getNodeName();
 
                         ifvnName.equalsIgnoreCase("VirtualNetworkSite") && vn.hasChildNodes() ) {
                             Element el = (Elementvn;
                             String siteName = el.getAttribute("name");
                             if (siteName.equalsIgnoreCase(vlanName)) {
                                 NodeList subnets = el.getElementsByTagName("Subnets");
 
                                 if (subnets != null && subnets.getLength() > 0) {
                                     .debug("Subnet exists");
                                     Element subnetList = (Elementsubnets.item(0);
                                     Element subnet = doc.createElement("Subnet");
                                     subnet.setAttribute("name"subName);
 
                                     Element addressPrefix = doc.createElement("AddressPrefix");
                                     addressPrefix.appendChild(doc.createTextNode(subCidr));
 
                                     subnet.appendChild(addressPrefix);
                                     subnetList.appendChild(subnet);
                                     break;
                                 }
                                 else {
                                     .debug("Subnet does not exist");
                                     Element subnetList = doc.createElement("Subnets");
                                     Element subnet = doc.createElement("Subnet");
                                     subnet.setAttribute("name"subName);
 
                                     Element addressPrefix = doc.createElement("AddressPrefix");
                                     addressPrefix.appendChild(doc.createTextNode(subCidr));
 
                                     subnet.appendChild(addressPrefix);
                                     subnetList.appendChild(subnet);
                                     el.appendChild(subnetList);
                                     break;
                                 }
                             }
                         }
                     }
                 }
             }
 
             String output="";
             try{
                 TransformerFactory tf = TransformerFactory.newInstance();
                 Transformer transformer = tf.newTransformer();
                 transformer.setOutputProperty(."yes");
                 StringWriter writer = new StringWriter();
                 transformer.transform(new DOMSource(doc), new StreamResult(writer));
                 output = writer.getBuffer().toString().replaceAll("\n|\r""");
             }
             catch (Exception e){
                 ..println(e);
             }
             xml.append(output);
             if.isDebugEnabled() ) {
                 try {
                     method.parseResponse(xml.toString(), false);
                 }
                 catchException e ) {
                     .warn("Unable to parse outgoing XML locally: " + e.getMessage());
                     .warn("XML:");
                     .warn(xml.toString());
                 }
             }
 
             String resourceDir =  + "/media";
             String requestId = method.invoke("PUT"ctx.getAccountNumber(),resourceDirxml.toString());
 
             if (requestId != null) {
                 int httpCode = method.getOperationStatus(requestId);
                 while (httpCode == -1) {
                     try {
                         Thread.sleep(15000L);
                     }
                     catch (InterruptedException ignored){}
                     httpCode = method.getOperationStatus(requestId);
                 }
                 if (httpCode == .) {
                     try {
                         return getSubnet(subName+"_"+vlan.getProviderVlanId());
                     }
                     catchThrowable ignore ) { }
                 }
             }
             return null;
         }
         finally {
             if.isTraceEnabled() ) {
                 .trace("EXIT: " + AzureVlanSupport.class.getName() + ".createSubnet()");
             }
         }
     }
 
     @Override
 	public VLAN createVlan(String cidrString nameString descriptionString domainNameString[] dnsServersString[] ntpServers)throws CloudExceptionInternalException {
         if.isTraceEnabled() ) {
             .trace("ENTER: " + AzureVlanSupport.class.getName() + ".createVlan()");
         }
 
         int mask = 32;
         if(cidr != null){
             String[] ipInfo = cidr.split("/");
 
             if(ipInfo != null && ipInfo.length >1){
                 mask = Integer.valueOf(ipInfo[1]);
             }
         }
         if(mask < 8 || mask > 29){
             .error("Azure address prefix size has to between /8 and /29");
             throw new InternalException("Azure address prefix size has to between /8 and /29");
         }
 
         try {
             ProviderContext ctx = .getContext();
 
             ifctx == null ) {
                 throw new AzureConfigException("No context was specified for this request");
             }
 
             String regionId = ctx.getRegionId();
             Collection<DataCenterdcs = .getDataCenterServices().listDataCenters(regionId);
             String dataCenterId = dcs.iterator().next().getProviderDataCenterId();
 
             AzureMethod method = new AzureMethod();
             StringBuilder xml = new StringBuilder();
 
             Document doc = getNetworkConfig();
             if (doc == null) {
                 xml.append("<NetworkConfiguration xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration\">");
                 xml.append("<VirtualNetworkConfiguration>");
                 xml.append("<Dns />");
                 xml.append("<VirtualNetworkSites>");
                 xml.append("<VirtualNetworkSite name=\"" + name"\" Location=\"" +  regionId +"\">");
                 xml.append("<AddressSpace>");
                 xml.append("<AddressPrefix>").append(cidr).append("</AddressPrefix>");
                 xml.append("</AddressSpace>");
                 xml.append("</VirtualNetworkSite>");
                 xml.append("</VirtualNetworkSites>");
                 xml.append("</VirtualNetworkConfiguration>");
                 xml.append("</NetworkConfiguration>");
             }
             else {
                 NodeList entries = doc.getElementsByTagName("VirtualNetworkConfiguration");
 
                 Node node = entries.item(0);
 
                 Element element = (Elementnode;
 
                 NodeList virtualNetworkSites = element.getElementsByTagName("VirtualNetworkSites");
                 Node item = virtualNetworkSites.item(0);
 
                 Element elItem;
                 if (item == null) {
                     elItem = doc.createElement("VirtualNetworkSites");
                     element.appendChild(elItem);
                 } else {
                     elItem = (Elementitem;
                 }
 
                 Element vns = doc.createElement("VirtualNetworkSite");
                 vns.setAttribute("name"name);
                 vns.setAttribute("Location"regionId);
 
                 Element addressSpace = doc.createElement("AddressSpace");
                 Element addressPrefix = doc.createElement("AddressPrefix");
                 addressPrefix.appendChild(doc.createTextNode(cidr));
 
                 addressSpace.appendChild(addressPrefix);
                 vns.appendChild(addressSpace);
                 elItem.appendChild(vns);
 
                 String output="";
                 try {
                     TransformerFactory tf = TransformerFactory.newInstance();
                     Transformer transformer = tf.newTransformer();
                     transformer.setOutputProperty(."yes");
                     StringWriter writer = new StringWriter();
                     transformer.transform(new DOMSource(doc), new StreamResult(writer));
                     output = writer.getBuffer().toString().replaceAll("\n|\r""");
                     xml.append(output);
                 }
                 catch (Exception e){
                     ..println(e);
                 }
             }
 
             if.isDebugEnabled() ) {
                 try {
                     method.parseResponse(xml.toString(), false);
                 }
                 catchException e ) {
                     .warn("Unable to parse outgoing XML locally: " + e.getMessage());
                     .warn("XML:");
                     .warn(xml.toString());
                 }
             }
 
             String resourceDir =  + "/media";
             String requestId = method.invoke("PUT"ctx.getAccountNumber(),resourceDirxml.toString());
 
             if (requestId != null) {
                 int httpCode = method.getOperationStatus(requestId);
                 while (httpCode == -1) {
                     try {
                         Thread.sleep(15000L);
                     }
                     catch (InterruptedException ignored){}
                     httpCode = method.getOperationStatus(requestId);
                 }
                 if (httpCode == .) {
                     try {
                         return getVlan(name);
                     }
                     catchThrowable ignore ) { }
                 }
             }
             return null;
         }
         finally {
             if.isTraceEnabled() ) {
                 .trace("EXIT: " + AzureVlanSupport.class.getName() + ".createVlan()");
             }
         }
 	}
 
         throw new OperationNotSupportedException("Network interfaces not supported");
 
 	}
 
     private transient volatile VlanCapabilities capabilities;
     @Override
         if == null ) {
              = new VlanCapabilities();
         }
         return ;
     }
 
     @Override
 		return "network interface";
 	}
 
 	public String getProviderTermForSubnet(Locale locale) {
 		return "Subnet";
 	}
 
 	public String getProviderTermForVlan(Locale locale) {
 		return "Address Space";
 	}
 
 		return null;
 	}
 
     private Document getNetworkConfig() throws CloudExceptionInternalException {
         ProviderContext ctx = .getContext();
 
         ifctx == null ) {
             throw new AzureConfigException("No context was specified for this request");
         }
         AzureMethod method = new AzureMethod();
 
         Document doc = method.getAsXML(ctx.getAccountNumber(), +"/media");
 
         return doc;
     }
 
 		return null;
 	}
 
         return null;
 	}
 
 	public Subnet getSubnet(String subnetIdthrows CloudException,InternalException {
         .debug("Enter getSubnet");
 
         ProviderContext ctx = .getContext();
 
         ifctx == null ) {
             throw new AzureConfigException("No context was specified for this request");
         }
         AzureMethod method = new AzureMethod();
 
         Document doc = method.getAsXML(ctx.getAccountNumber(), +"/virtualnetwork");
 
         NodeList entries = doc.getElementsByTagName("VirtualNetworkSite");
 
         forint i=0; i<entries.getLength(); i++ ) {
             .debug("Searching vlans");
             Node entry = entries.item(i);
             NodeList attributes = entry.getChildNodes();
 
             String vlanId = "";
             String vlanName = "";
 
             forint j=0; j<attributes.getLength(); j++ ) {
                 Node attribute = attributes.item(j);
                 if(attribute.getNodeType() == .continue;
                 String nodeName = attribute.getNodeName();
 
                 if (nodeName.equalsIgnoreCase("id") && attribute.hasChildNodes() ) {
                     vlanId = attribute.getFirstChild().getNodeValue().trim();
                 }
                 else ifnodeName.equalsIgnoreCase("name") && attribute.hasChildNodes() ) {
                     vlanName = attribute.getFirstChild().getNodeValue().trim();
                 }
 
                 else if (nodeName.equalsIgnoreCase("subnets") && attribute.hasChildNodes()) {
                     NodeList sNets = attribute.getChildNodes();
                     for (int k=0; k<sNets.getLength(); k++) {
                         Node sAttrib = sNets.item(k);
 
                         Subnet subnet = toSubnet(ctxsAttribvlanId);
                         ifsubnet != null && subnet.getProviderSubnetId().equalsIgnoreCase(subnetId)) {
                             subnet.setTag("vlanName"vlanName);
                             return subnet;
                         }
                     }
                 }
             }
         }
 		return null;
 	}
 
 	public VLAN getVlan(String vlanIdthrows CloudExceptionInternalException {
 		if(list != null){ 
 			for(VLAN vlanlist){
 				if(vlan.getProviderVlanId().equals(vlanId) || vlan.getName().equalsIgnoreCase(vlanId)){
 					return vlan;
 				}			
 			}
 		}
 		return null;		
 	}
 
     @Override
     public boolean isConnectedViaInternetGateway(@Nonnull String sthrows CloudExceptionInternalException {
         return false;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Nullable
     @Override
     public String getAttachedInternetGatewayId(@Nonnull String vlanIdthrows CloudExceptionInternalException {
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Nullable
     @Override
     public InternetGateway getInternetGatewayById(@Nonnull String gatewayIdthrows CloudExceptionInternalException {
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
 	public boolean isSubscribed() throws CloudExceptionInternalException {
 		return true;
 	}
 
 		// TODO Auto-generated method stub
 		return null;
 	}
 
     @Nonnull
     @Override
     public Collection<InternetGatewaylistInternetGateways(@Nullable String vlanIdthrows CloudExceptionInternalException {
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Nonnull
     @Override
         return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
         return Collections.emptyList();
 	}
 
         return Collections.emptyList();
 	}
 
 			String subnetIdthrows CloudExceptionInternalException {
         return Collections.emptyList();
 	}
 
         return Collections.emptyList();
 	}
 
     @Nonnull
     @Override
     public Iterable<NetworkablelistResources(@Nonnull String inVlanIdthrows CloudExceptionInternalException {
         return Collections.emptyList();
     }
 
     @Override
         return Collections.emptyList();
 	}
 
         ProviderContext ctx = .getContext();
 
         ifctx == null ) {
             throw new AzureConfigException("No context was specified for this request");
         }
         AzureMethod method = new AzureMethod();
 
         Document doc = method.getAsXML(ctx.getAccountNumber(), +"/virtualnetwork");
 
         NodeList entries = doc.getElementsByTagName("VirtualNetworkSite");
         ArrayList<Subnetlist = new ArrayList<Subnet>();
 
         forint i=0; i<entries.getLength(); i++ ) {
             Node entry = entries.item(i);
             NodeList attributes = entry.getChildNodes();
 
             String vlanId;
             boolean found = false;
 
             forint j=0; j<attributes.getLength(); j++ ) {
                 Node attribute = attributes.item(j);
                 if(attribute.getNodeType() == .continue;
                 String nodeName = attribute.getNodeName();
 
                 if (nodeName.equalsIgnoreCase("id") && attribute.hasChildNodes() ) {
                     vlanId = attribute.getFirstChild().getNodeValue().trim();
                     if (vlanId.equalsIgnoreCase(inVlanId)) {
                         found = true;
                         continue;
                     }
                 }
 
                 //hopefully we have found the right vlan
                 if (found) {
                     if (nodeName.equalsIgnoreCase("subnets") && attribute.hasChildNodes()) {
                         NodeList sNets = attribute.getChildNodes();
                         for (int k=0; k<sNets.getLength(); k++) {
                             Node sAttrib = sNets.item(k);
 
                             Subnet subnet = toSubnet(ctxsAttribinVlanId);
                             ifsubnet != null ) {
                                 list.add(subnet);
                             }
                         }
                     }
                 }
             }
         }
         return list;
 	}
 
 	@Nonnull
     @Override
         ProviderContext ctx = .getContext();
 
         ifctx == null ) {
             throw new AzureConfigException("No context was specified for this request");
         }
         AzureMethod method = new AzureMethod();
 
         Document doc = method.getAsXML(ctx.getAccountNumber(), +"/virtualnetwork");
 
         NodeList entries = doc.getElementsByTagName("VirtualNetworkSite");
         ArrayList<ResourceStatuslist = new ArrayList<ResourceStatus>();
 
         forint i=0; i<entries.getLength(); i++ ) {
             Node entry = entries.item(i);
             ResourceStatus status = toVLANStatus(ctxentry);
             ifstatus != null ) {
                 list.add(status);
             }
         }
         return list;
     }
 
     @Override
 
         ProviderContext ctx = .getContext();
 
         ifctx == null ) {
             throw new AzureConfigException("No context was specified for this request");
         }
         AzureMethod method = new AzureMethod();
 
         Document doc = method.getAsXML(ctx.getAccountNumber(), +"/virtualnetwork");
                 
         NodeList entries = doc.getElementsByTagName("VirtualNetworkSite");
         ArrayList<VLANlist = new ArrayList<VLAN>();
 
         forint i=0; i<entries.getLength(); i++ ) {
             Node entry = entries.item(i);
             ArrayList<VLANvlans = (ArrayList<VLAN>) toVLAN(ctxentry);
             ifvlans != null ) {
             	list.addAll(vlans);
             }
         }        
         return list;
 	}
 	
 	public void removeInternetGateway(String forVlanIdthrows CloudException,InternalException {
         throw new OperationNotSupportedException("Internet gateways not supported");
 	}
 
     @Override
     public void removeInternetGatewayById(@Nonnull String idthrows CloudExceptionInternalException {
         //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
 	public void removeNetworkInterface(String nicIdthrows CloudException,
         throw new OperationNotSupportedException("Network interfaces not supported");
 
 	}
 
 	public void removeRoute(String inRoutingTableIdString destinationCidr)
         throw new OperationNotSupportedException("Routing tables not supported");
 
 	}
 
 	public void removeRoutingTable(String routingTableId)
         throw new OperationNotSupportedException("Routing tables not supported");
 
 	}
 
 	public void removeSubnet(String providerSubnetIdthrows CloudException,InternalException {
         if.isTraceEnabled() ) {
             .trace("ENTER: " + AzureVlanSupport.class.getName() + ".removeSubnet()");
         }
 
         try {
             ProviderContext ctx = .getContext();
 
             ifctx == null ) {
                 throw new AzureConfigException("No context was specified for this request");
             }
 
             Subnet subnet = getSubnet(providerSubnetId);
 
             String vlanId = subnet.getProviderVlanId();
             VLAN vlan = getVlan(vlanId);
             String vlanName = vlan.getName();
 
             AzureMethod method = new AzureMethod();
             StringBuilder xml = new StringBuilder();
 
             Document doc = getNetworkConfig();
             NodeList entries = doc.getElementsByTagName("VirtualNetworkConfiguration");
 
             Element element = (Elemententries.item(0);
 
             NodeList virtualNetworkSites = element.getElementsByTagName("VirtualNetworkSites");
 
             Element elItem = (ElementvirtualNetworkSites.item(0);
             NodeList vns = elItem.getElementsByTagName("VirtualNetworkSite");
             for (int i = 0; i<vns.getLength(); i++) {
                 Node vn = vns.item(i);
                 String vnName = vn.getNodeName();
 
                 ifvnName.equalsIgnoreCase("VirtualNetworkSite") && vn.hasChildNodes() ) {
                     Element elVN = (Elementvn;
                     String siteName = elVN.getAttribute("name");
                     if (siteName.equalsIgnoreCase(vlanName)) {
                         NodeList subnetsNodes = elVN.getElementsByTagName("Subnets");
 
                         Element subnetsEl = (ElementsubnetsNodes.item(0);
 
                         NodeList subnetNodes = subnetsEl.getElementsByTagName("Subnet");
 
                         for (int j = 0; j<subnetNodes.getLength(); j++) {
                             Node subnetNode = subnetNodes.item(j);
 
                             String subnetName = subnetNode.getNodeName();
                             ifsubnetName.equalsIgnoreCase("Subnet") && vn.hasChildNodes() ) {
                                 Element sub = (ElementsubnetNode;
                                 String subName = sub.getAttribute("name");
                                 if (subName.equalsIgnoreCase(subnet.getName())) {
                                     subnetsEl.removeChild(subnetNode);
                                 }
                             }
                         }
                     }
                 }
             }
 
             String output="";
             try{
                 TransformerFactory tf = TransformerFactory.newInstance();
                 Transformer transformer = tf.newTransformer();
                 transformer.setOutputProperty(."yes");
                 StringWriter writer = new StringWriter();
                 transformer.transform(new DOMSource(doc), new StreamResult(writer));
                 output = writer.getBuffer().toString().replaceAll("\n|\r""");
             }
             catch (Exception e){
                 ..println(e);
             }
             xml.append(output);
             if.isDebugEnabled() ) {
                 try {
                     method.parseResponse(xml.toString(), false);
                 }
                 catchException e ) {
                     .warn("Unable to parse outgoing XML locally: " + e.getMessage());
                     .warn("XML:");
                     .warn(xml.toString());
                 }
             }
 
             String resourceDir =  + "/media";
             method.invoke("PUT"ctx.getAccountNumber(),resourceDirxml.toString());
         }
         finally {
             if.isTraceEnabled() ) {
                 .trace("EXIT: " + AzureVlanSupport.class.getName() + ".removeSubnet()");
             }
         }
 
 	}
 
 	public void removeVlan(String vlanIdthrows CloudException,InternalException {
         if.isTraceEnabled() ) {
             .trace("ENTER: " + AzureVlanSupport.class.getName() + ".removeVlan()");
         }
 
         try {
             ProviderContext ctx = .getContext();
 
             ifctx == null ) {
                 throw new AzureConfigException("No context was specified for this request");
             }
 
             VLAN vlan = getVlan(vlanId);
             String vlanName = vlan.getName();
 
             AzureMethod method = new AzureMethod();
             StringBuilder xml = new StringBuilder();
 
             Document doc = getNetworkConfig();
             NodeList entries = doc.getElementsByTagName("VirtualNetworkConfiguration");
 
             Element element = (Elemententries.item(0);
 
             NodeList virtualNetworkSites = element.getElementsByTagName("VirtualNetworkSites");
 
             Element elItem = (ElementvirtualNetworkSites.item(0);
             NodeList vns = elItem.getElementsByTagName("VirtualNetworkSite");
             for (int i = 0; i<vns.getLength(); i++) {
                 Node vn = vns.item(i);
                 String vnName = vn.getNodeName();
 
                 ifvnName.equalsIgnoreCase("VirtualNetworkSite") && vn.hasChildNodes() ) {
                     Element elVN = (Elementvn;
                     String siteName = elVN.getAttribute("name");
                     if (siteName.equalsIgnoreCase(vlanName)) {
                         elItem.removeChild(vn);
                     }
                 }
             }
 
             String output="";
             try{
                 TransformerFactory tf = TransformerFactory.newInstance();
                 Transformer transformer = tf.newTransformer();
                 transformer.setOutputProperty(."yes");
                 StringWriter writer = new StringWriter();
                 transformer.transform(new DOMSource(doc), new StreamResult(writer));
                 output = writer.getBuffer().toString().replaceAll("\n|\r""");
             }
             catch (Exception e){
                 ..println(e);
             }
             xml.append(output);
             if.isDebugEnabled() ) {
                 try {
                     method.parseResponse(xml.toString(), false);
                 }
                 catchException e ) {
                     .warn("Unable to parse outgoing XML locally: " + e.getMessage());
                     .warn("XML:");
                     .warn(xml.toString());
                 }
             }
 
             String resourceDir =  + "/media";
             method.invoke("PUT"ctx.getAccountNumber(),resourceDirxml.toString());
         }
         finally {
             if.isTraceEnabled() ) {
                 .trace("EXIT: " + AzureVlanSupport.class.getName() + ".removeVlan()");
             }
         }
 
 	}
 
     @Override
     public void removeVLANTags(@Nonnull String s, @Nonnull Tag... tagsthrows CloudExceptionInternalException {
         //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
     public void removeVLANTags(@Nonnull String[] strings, @Nonnull Tag... tagsthrows CloudExceptionInternalException {
         //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
     public void updateVLANTags(@Nonnull String s, @Nonnull Tag... tagsthrows CloudExceptionInternalException {
         //To change body of implemented methods use File | Settings | File Templates.
     }
 
     @Override
     public void updateVLANTags(@Nonnull String[] strings, @Nonnull Tag... tagsthrows CloudExceptionInternalException {
         //To change body of implemented methods use File | Settings | File Templates.
     }

    
Updates meta-data for an internet gateway with the new values. It will not overwrite any value that currently exists unless it appears in the tags you submit.

Parameters:
internetGatewayId the internet gateway to update
tags the meta-data tags to set
Throws:
org.dasein.cloud.CloudException an error occurred within the cloud provider
org.dasein.cloud.InternalException an error occurred within the Dasein Cloud API implementation
 
     @Override
     public void updateInternetGatewayTags(@Nonnull String internetGatewayId, @Nonnull Tag... tagsthrows CloudExceptionInternalException {
 
     }
 
     private @Nullable Iterable<VLANtoVLAN(@Nonnull ProviderContext ctx, @Nullable Node entrythrows CloudExceptionInternalException {
         ifentry == null ) {
             return null;
         }
 
         ArrayList<VLANlistnew ArrayList<VLAN>();
 
         VLAN vlan = new VLAN();
         vlan.setProviderOwnerId(ctx.getAccountNumber());
         vlan.setProviderRegionId(ctx.getRegionId());
         vlan.setSupportedTraffic(.);
 
         HashMap<String,Stringtags = new HashMap<StringString>();
         NodeList attributes = entry.getChildNodes();
         String id;
         String value;
         VLANState state;
 
         forint i=0; i<attributes.getLength(); i++ ) {
             Node attribute = attributes.item(i);
             if(attribute.getNodeType() == .continue;
             String nodeName = attribute.getNodeName();
 
             ifnodeName.equalsIgnoreCase("name") && attribute.hasChildNodes() ) {
                 vlan.setName(attribute.getFirstChild().getNodeValue().trim());
             }
             else if (nodeName.equalsIgnoreCase("label") && attribute.hasChildNodes() ) {
                 vlan.setDescription(attribute.getFirstChild().getNodeValue().trim());
             }
             else if (nodeName.equalsIgnoreCase("id") && attribute.hasChildNodes() ) {
                 id = attribute.getFirstChild().getNodeValue().trim();
                 tags.put(.id);
                 vlan.setProviderVlanId(id);
             }
             else if (nodeName.equalsIgnoreCase("affinitygroup") && attribute.hasChildNodes() ) {
                 String affinityGroup = attribute.getFirstChild().getNodeValue().trim();
                 if (affinityGroup != null && !affinityGroup.equals("")) {
                     AffinityGroup affinityGroupModel = .getComputeServices().getAffinityGroupSupport().get(affinityGroup);
                     if(affinityGroupModel == null)
                         return null;
 
                     DataCenter dc = .getDataCenterServices().getDataCenter(affinityGroupModel.getDataCenterId());
                     if ( dc != null && dc.getRegionId().equals(ctx.getRegionId())) {
                         vlan.setProviderDataCenterId(dc.getProviderDataCenterId());
                     }
                     else {
                         return null;
                     }
                 }
                 tags.put("AffinityGroup"attribute.getFirstChild().getNodeValue().trim());
             }
             else if (nodeName.equalsIgnoreCase("location") && attribute.hasChildNodes() ) {
                 String location = attribute.getFirstChild().getNodeValue().trim();
                 if (location != null && !location.equals("")) {
                     Region region = .getDataCenterServices().getRegion(location);
                     if ( region != null && !region.getProviderRegionId().equals(ctx.getRegionId())) {
                         return null;
                     }
                     else
                     {
                         DataCenter dc = .getDataCenterServices().getDataCenter(region.getProviderRegionId());