Beispiel #1
0
    def bring_down_all_interfaces(cls, network_state: NetworkState) -> bool:
        """Bring down all interfaces.

        Return True is successful, otherwise return False
        """
        return cls.bring_down_interfaces(
            [i['name'] for i in network_state.iter_interfaces()])
Beispiel #2
0
 def _render_persistent_net(network_state: NetworkState):
     """Given state, emit udev rules to map mac to ifname."""
     # TODO(harlowja): this seems shared between eni renderer and
     # this, so move it to a shared location.
     content = io.StringIO()
     for iface in network_state.iter_interfaces(filter_by_physical):
         # for physical interfaces write out a persist net udev rule
         if "name" in iface and iface.get("mac_address"):
             driver = iface.get("driver", None)
             content.write(
                 generate_udev_rule(iface["name"],
                                    iface["mac_address"],
                                    driver=driver))
     return content.getvalue()
Beispiel #3
0
 def bring_up_all_interfaces(cls, network_state: NetworkState) -> bool:
     return cls.bring_up_interfaces(
         [i['name'] for i in network_state.iter_interfaces()])