Ejemplo n.º 1
0
 def test_with_header(self):
     header = "# hello world\n"
     rendered = eni.network_state_to_eni(
         network_state=network_state.parse_net_config_data(self.mycfg),
         header=header, render_hwaddress=True)
     self.assertIn(header, rendered)
     self.assertIn(self.my_mac, rendered)
Ejemplo n.º 2
0
 def test_with_header(self):
     header = "# hello world\n"
     rendered = eni.network_state_to_eni(
         network_state=network_state.parse_net_config_data(self.mycfg),
         header=header, render_hwaddress=True)
     self.assertIn(header, rendered)
     self.assertIn(self.my_mac, rendered)
Ejemplo n.º 3
0
 def _apply_network_from_network_config(self, netconfig, bring_up=True):
     distro = self.__class__
     LOG.warn("apply_network_config is not currently implemented "
              "for distribution '%s'.  Attempting to use apply_network",
              distro)
     header = '\n'.join([
         "# Converted from network_config for distro %s" % distro,
         "# Implmentation of _write_network_config is needed."
     ])
     ns = network_state.parse_net_config_data(netconfig)
     contents = eni.network_state_to_eni(
         ns, header=header, render_hwaddress=True)
     return self.apply_network(contents, bring_up=bring_up)
Ejemplo n.º 4
0
 def _apply_network_from_network_config(self, netconfig, bring_up=True):
     distro = self.__class__
     LOG.warn("apply_network_config is not currently implemented "
              "for distribution '%s'.  Attempting to use apply_network",
              distro)
     header = '\n'.join([
         "# Converted from network_config for distro %s" % distro,
         "# Implmentation of _write_network_config is needed."
     ])
     ns = network_state.parse_net_config_data(netconfig)
     contents = eni.network_state_to_eni(
         ns, header=header, render_hwaddress=True)
     return self.apply_network(contents, bring_up=bring_up)
Ejemplo n.º 5
0
 def _apply_network_from_network_config(self, netconfig, bring_up=True):
     """Deprecated. Remove if/when arch and gentoo support renderers."""
     distro = self.__class__
     LOG.warning(
         "apply_network_config is not currently implemented "
         "for distribution '%s'.  Attempting to use apply_network",
         distro,
     )
     header = "\n".join([
         "# Converted from network_config for distro %s" % distro,
         "# Implementation of _write_network_config is needed.",
     ])
     ns = network_state.parse_net_config_data(netconfig)
     contents = eni.network_state_to_eni(ns,
                                         header=header,
                                         render_hwaddress=True)
     return self.apply_network(contents, bring_up=bring_up)
Ejemplo n.º 6
0
 def test_no_hwaddress(self):
     rendered = eni.network_state_to_eni(
         network_state=network_state.parse_net_config_data(self.mycfg),
         render_hwaddress=False)
     self.assertNotIn(self.my_mac, rendered)
     self.assertNotIn("hwaddress", rendered)
Ejemplo n.º 7
0
 def test_no_hwaddress(self):
     rendered = eni.network_state_to_eni(
         network_state=network_state.parse_net_config_data(self.mycfg),
         render_hwaddress=False)
     self.assertNotIn(self.my_mac, rendered)
     self.assertNotIn("hwaddress", rendered)