def ex_attach_firewall_policy(self, policy, node, nic_mac=None):
        nics = copy.deepcopy(node.extra.get('nics', []))

        if nic_mac:
            nic = [n for n in nics if n['mac'] == nic_mac]
        else:
            nic = nics

        if len(nic) == 0:
            raise ValueError('Cannot find the NIC interface to attach '
                             'a policy to')

        nic = nic[0]
        nic['firewall_policy'] = policy.id

        params = {'nics': nics}
        node = self.ex_edit_node(node=node, params=params)
        return node
Attach firewall policy to a public NIC interface on the server.
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/cloudsigma.py/CloudSigma_2_0_NodeDriver.ex_attach_firewall_policy