Exemplo n.º 1
0
 def _validate_network_segment_range_eligible(self, network_segment_range):
     range_data = (network_segment_range.get('minimum'),
                   network_segment_range.get('maximum'))
     # Currently, network segment range only supports VLAN, VxLAN,
     # GRE and Geneve.
     if network_segment_range.get('network_type') == const.TYPE_VLAN:
         plugin_utils.verify_vlan_range(range_data)
     else:
         plugin_utils.verify_tunnel_range(
             range_data, network_segment_range.get('network_type'))
Exemplo n.º 2
0
 def _parse_tunnel_ranges(self, tunnel_ranges, current_range):
     for entry in tunnel_ranges:
         entry = entry.strip()
         try:
             tun_min, tun_max = entry.split(':')
             tun_min = tun_min.strip()
             tun_max = tun_max.strip()
             tunnel_range = int(tun_min), int(tun_max)
         except ValueError as ex:
             raise exc.NetworkTunnelRangeError(tunnel_range=entry, error=ex)
         plugin_utils.verify_tunnel_range(tunnel_range, self.get_type())
         current_range.append(tunnel_range)
     LOG.info("%(type)s ID ranges: %(range)s",
              {'type': self.get_type(), 'range': current_range})
Exemplo n.º 3
0
 def _parse_tunnel_ranges(self, tunnel_ranges, current_range):
     for entry in tunnel_ranges:
         entry = entry.strip()
         try:
             tun_min, tun_max = entry.split(':')
             tun_min = tun_min.strip()
             tun_max = tun_max.strip()
             tunnel_range = int(tun_min), int(tun_max)
         except ValueError as ex:
             raise exc.NetworkTunnelRangeError(tunnel_range=entry, error=ex)
         plugin_utils.verify_tunnel_range(tunnel_range, self.get_type())
         current_range.append(tunnel_range)
     LOG.info("%(type)s ID ranges: %(range)s", {
         'type': self.get_type(),
         'range': current_range
     })
Exemplo n.º 4
0
 def test_verify_tunnel_range(self):
     for r in [[0, 1], [-1, 0], [1, 2]]:
         self.assertIsNone(
             utils.verify_tunnel_range(r, constants.TYPE_FLAT))