Example #1
0
 def test__get_dvr_mac_address_by_host(self):
     entry = router.DVRMacAddress(self.ctx,
                                  host='foo_host',
                                  mac_address=tools.get_random_EUI())
     entry.create()
     result = self.mixin._get_dvr_mac_address_by_host(self.ctx, 'foo_host')
     self.assertEqual(entry.to_dict(), result)
Example #2
0
    def _create_dvr_mac_address_retry(self, context, host, base_mac):
        with db_api.context_manager.writer.using(context):
            mac_address = utils.get_random_mac(base_mac)
            dvr_mac_binding = router.DVRMacAddress(
                context, host=host, mac_address=netaddr.EUI(mac_address))
            dvr_mac_binding.create()
            LOG.debug("Generated DVR mac for host %(host)s "
                      "is %(mac_address)s",
                      {'host': host, 'mac_address': mac_address})

        dvr_macs = self.get_dvr_mac_address_list(context)
        # TODO(vivek): improve scalability of this fanout by
        # sending a single mac address rather than the entire set
        self.notifier.dvr_mac_address_update(context, dvr_macs)
        return self._make_dvr_mac_address_dict(dvr_mac_binding)
Example #3
0
 def _create_dvr_mac_entry(self, host, mac_address):
     router.DVRMacAddress(self.ctx, host=host,
                          mac_address=mac_address).create()