Package org.apache.cloudstack.network.contrail.model

Examples of org.apache.cloudstack.network.contrail.model.VirtualNetworkModel


        s_logger.debug("deviceId: " + nic.getDeviceId());

        NicVO nicVO = _nicDao.findById(nic.getId());
        assert nicVO != null;

        VirtualNetworkModel vnModel = _manager.getDatabase().lookupVirtualNetwork(network.getUuid(), _manager.getCanonicalName(network), network.getTrafficType());
        /* Network must have been implemented */
        assert vnModel != null;

        VirtualMachineModel vmModel = _manager.getDatabase().lookupVirtualMachine(vm.getUuid());
        if (vmModel == null) {
View Full Code Here


    }

    @Override
    public void shutdown(NetworkProfile network, NetworkOffering offering) {
        s_logger.debug("NetworkGuru shutdown");
        VirtualNetworkModel vnModel = _manager.getDatabase().lookupVirtualNetwork(network.getUuid(), _manager.getCanonicalName(network), network.getTrafficType());
        if (vnModel == null) {
            return;
        }
        try {
            _manager.getDatabase().getVirtualNetworks().remove(vnModel);
            vnModel.delete(_manager.getModelController());
        } catch (IOException e) {
            s_logger.warn("virtual-network delete", e);
        }
    }
View Full Code Here

    public TreeSet<VirtualNetworkModel> getVirtualNetworks() {
        return _vnTable;
    }

    public VirtualNetworkModel lookupVirtualNetwork(String uuid, String name, TrafficType ttype) {
        VirtualNetworkModel vnKey = new VirtualNetworkModel(null, uuid, name, ttype);
        VirtualNetworkModel current = _vnTable.ceiling(vnKey);
        if (current != null) {
            if (ttype == TrafficType.Management || ttype == TrafficType.Storage || ttype == TrafficType.Control) {
                if (current.getName().equals(name)) {
                    return current;
                }
            } else if (current.getUuid().equals(uuid)) {
                return current;
            }
        }
        return null;
    }
View Full Code Here

        s_logger.debug("NetworkElement implement: " + network.getName() + ", traffic type: " + network.getTrafficType());
        if (network.getTrafficType() == TrafficType.Guest) {
            s_logger.debug("ignore network " + network.getName());
            return true;
        }
        VirtualNetworkModel vnModel = _manager.getDatabase().lookupVirtualNetwork(network.getUuid(), _manager.getCanonicalName(network), network.getTrafficType());

        if (vnModel == null) {
            vnModel = new VirtualNetworkModel(network, network.getUuid(), _manager.getCanonicalName(network), network.getTrafficType());
            vnModel.setProperties(_manager.getModelController(), network);
        }
        try {
            if (!vnModel.verify(_manager.getModelController())) {
                vnModel.update(_manager.getModelController());
            }
            _manager.getDatabase().getVirtualNetworks().add(vnModel);
        } catch (Exception ex) {
            s_logger.warn("virtual-network update: ", ex);
        }
View Full Code Here

            return true;
        }

        s_logger.debug("network: " + network.getId());

        VirtualNetworkModel vnModel = _manager.getDatabase().lookupVirtualNetwork(network.getUuid(), _manager.getCanonicalName(network), network.getTrafficType());

        if (vnModel == null) {
            // There is no notification after a physical network is associated with the VRouter NetworkOffering
            // this may be the first time we see this network.
            return false;
View Full Code Here

        if (right.getTrafficType() == TrafficType.Guest) {
            _networkModel.checkNetworkPermissions(owner, right);
        }

        final ApiConnector api = _manager.getApiConnector();
        VirtualNetworkModel leftModel = _manager.getDatabase().lookupVirtualNetwork(left.getUuid(),
                _manager.getCanonicalName(left), left.getTrafficType());
        if (leftModel == null) {
            throw new CloudRuntimeException("Unable to read virtual-network object");
        }
        VirtualNetworkModel rightModel = _manager.getDatabase().lookupVirtualNetwork(right.getUuid(),
                _manager.getCanonicalName(right), right.getTrafficType());
        if (rightModel == null) {
            throw new CloudRuntimeException("Unable to read virtual-network object");
        }
View Full Code Here

    public TreeSet<VirtualNetworkModel> getVirtualNetworks() {
        return _vnTable;
    }
   
    public VirtualNetworkModel lookupVirtualNetwork(String uuid, String name, TrafficType ttype) {
        VirtualNetworkModel vnKey = new VirtualNetworkModel(null, uuid, name, ttype);
        VirtualNetworkModel current = _vnTable.ceiling(vnKey);
        if (current != null) {
            if (ttype == TrafficType.Management || ttype == TrafficType.Storage
                    || ttype == TrafficType.Control) {
                if (current.getName().equals(name)) {
                    return current;
                }
            } else if (current.getUuid().equals(uuid)) {
                return current;
            }
        }
        return null;
    }
View Full Code Here

      s_logger.debug("NetworkElement implement: " + network.getName() + ", traffic type: " + network.getTrafficType());
      if (network.getTrafficType() == TrafficType.Guest) {
          s_logger.debug("ignore network " + network.getName());
          return true;       
      }
      VirtualNetworkModel vnModel = _manager.getDatabase().lookupVirtualNetwork(network.getUuid(),
              _manager.getCanonicalName(network), network.getTrafficType());

      if (vnModel == null) {
          vnModel = new VirtualNetworkModel(network, network.getUuid(),
                  _manager.getCanonicalName(network), network.getTrafficType());
          vnModel.setProperties(_manager.getModelController(), network);
      }
      try {
          if (!vnModel.verify(_manager.getModelController())) {
              vnModel.update(_manager.getModelController());
          }
          _manager.getDatabase().getVirtualNetworks().add(vnModel);  
      } catch (Exception ex) {
          s_logger.warn("virtual-network update: ", ex);
      }
View Full Code Here

          return true;
      }

      s_logger.debug("network: " + network.getId());
     
      VirtualNetworkModel vnModel = _manager.getDatabase().lookupVirtualNetwork(network.getUuid(),
                _manager.getCanonicalName(network), network.getTrafficType());
     
      if (vnModel == null) {
          // There is no notification after a physical network is associated with the VRouter NetworkOffering
          // this may be the first time we see this network.
View Full Code Here

                _manager.getCanonicalName(dbNet), dbNet.getTrafficType()) != null) {
             s_logger.warn("VN model object is already present in DB: " +
                                   dbNet.getUuid() + ", name: " + dbNet.getName());     
        }
       
        VirtualNetworkModel vnModel = new VirtualNetworkModel(dbNet,
                dbNet.getUuid(), _manager.getCanonicalName(dbNet), dbNet.getTrafficType());
        if (dbNet.getTrafficType() == TrafficType.Guest && dbNet.getNetworkACLId() != null) {
            NetworkACLVO acl = _networkACLDao.findById(dbNet.getNetworkACLId());
            NetworkPolicyModel policyModel = _manager.getDatabase().lookupNetworkPolicy(acl.getUuid());
            if (policyModel == null) {
                s_logger.error("Network(" + dbNet.getName() + ") has ACL but policy model not created: " +
                                       acl.getUuid() + ", name: " + acl.getName());     
            } else {
                vnModel.addToNetworkPolicy(policyModel);
            }
        }
        vnModel.build(_manager.getModelController(), dbNet);

        if (_rw_mode) {
            try {
                if (!vnModel.verify(_manager.getModelController())) {
                    vnModel.update(_manager.getModelController());
                }
            } catch (InternalErrorException ex) {
                s_logger.warn("create virtual-network", ex);
                syncLogMesg.append("Error: VN# VNC : Unable to create network " +
                    dbNet.getName() + "\n");
                return;
            }
            s_logger.debug("add model " + vnModel.getName());
            _manager.getDatabase().getVirtualNetworks().add(vnModel);
            syncLogMesg.append("VN# VNC: " + dbNet.getUuid() + ", " + vnModel.getName() + " created\n");
        } else {
            syncLogMesg.append("VN# VNC: " + vnModel.getName() + " created \n");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.network.contrail.model.VirtualNetworkModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.