Esempio n. 1
0
 /**
  * Removes the virtual link from the map.
  *
  * @param virtualLink the virtual link
  */
 public void removeVirtualLink(OVXLink virtualLink) {
   if (this.virtualLinkMap.containsKey(virtualLink)) {
     List<PhysicalLink> physicalLinks =
         Collections.unmodifiableList(this.virtualLinkMap.get(virtualLink));
     for (PhysicalLink physicalLink : physicalLinks) {
       if (this.physicalLinkMap.get(physicalLink).containsKey(virtualLink.getTenantId())) {
         this.physicalLinkMap.get(physicalLink).remove(virtualLink.getTenantId());
       }
     }
     this.virtualLinkMap.remove(virtualLink);
   }
 }
Esempio n. 2
0
 /**
  * Sets up the mapping from the physical link to the OVXLinks which contain the given physical
  * link.
  *
  * @param virtualLink OVXLink contains the OVXPort and OVXSwitch for source and destination in the
  *     OVXNetwork
  */
 private void addPhysicalLink(final PhysicalLink physicalLink, final OVXLink virtualLink) {
   ConcurrentHashMap<Integer, List<OVXLink>> linkMap = this.physicalLinkMap.get(physicalLink);
   if (linkMap == null) {
     linkMap = new ConcurrentHashMap<Integer, List<OVXLink>>();
     this.physicalLinkMap.put(physicalLink, linkMap);
   }
   List<OVXLink> linkList = linkMap.get(virtualLink.getTenantId());
   if (linkList == null) {
     linkList = new ArrayList<OVXLink>();
     linkMap.put(virtualLink.getTenantId(), linkList);
   }
   linkList.add(virtualLink);
 }