Ejemplo n.º 1
0
 def _get_qos(self):
     qos = None
     # The order of these condition is necessary. When would qos and pass_through specified it would try to create and qos and fail on engine.
     if self.param('qos') == '' or self.param('pass_through') == 'enabled':
         qos = otypes.Qos()
     elif self.param('qos'):
         qos = otypes.Qos(id=self._get_qos_id())
     return qos
Ejemplo n.º 2
0
 def _get_qos(self):
     qos = None
     if self.param('qos'):
         qos = otypes.Qos(id=self._get_qos_id())
     elif self.param('qos') == '' or self.param(
             'pass_through') == 'enabled':
         qos = otypes.Qos()
     return qos
Ejemplo n.º 3
0
 def create(self,
            name,
            qos_type,
            inbound_average=None,
            inbound_peak=None,
            inbound_burst=None,
            outbound_average=None,
            outbound_peak=None,
            outbound_burst=None,
            outbound_average_upperlimit=None,
            outbound_average_realtime=None,
            outbound_average_linkshare=None):
     self._create_sdk_entity(
         types.Qos(name=name,
                   type=qos_type,
                   inbound_average=inbound_average,
                   inbound_peak=inbound_peak,
                   inbound_burst=inbound_burst,
                   outbound_average=outbound_average,
                   outbound_peak=outbound_peak,
                   outbound_burst=outbound_burst,
                   outbound_average_upperlimit=outbound_average_upperlimit,
                   outbound_average_realtime=outbound_average_realtime,
                   outbound_average_linkshare=outbound_average_linkshare))
     self.get_sdk_type().id = self.id
Ejemplo n.º 4
0
 def build_entity(self):
     return otypes.VnicProfile(
         name=self.param('name'),
         network=otypes.Network(id=self.__get_network_id()),
         description=self.param('description')
         if self.param('description') else None,
         port_mirroring=self.param('port_mirroring'),
         pass_through=otypes.VnicPassThrough(mode=otypes.VnicPassThroughMode(self.param('pass_through')))
         if self.param('pass_through') else None,
         migratable=self.param('migratable'),
         custom_properties=[
             otypes.CustomProperty(
                 name=cp.get('name'),
                 regexp=cp.get('regexp'),
                 value=str(cp.get('value')),
             ) for cp in self.param('custom_properties') if cp
         ] if self.param('custom_properties') is not None else None,
         qos=otypes.Qos(id=self.__get_qos_id())
         if self.param('qos') else None,
         network_filter=otypes.NetworkFilter(id=self.__get_network_filter_id())
         if self.param('network_filter') is not None else None
     )