def apply_policy(self, policy):
tenant_name = policy['<STR_LIT>']<EOL>fw_id = policy['<STR_LIT>']<EOL>fw_name = policy['<STR_LIT>']<EOL>LOG.info("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': tenant_name, '<STR_LIT>': fw_id, '<STR_LIT>': fw_name})<EOL>cmds = ["<STR_LIT>", "<STR_LIT>" + tenant_name]<EOL>for rule_id, rule in policy['<STR_LIT>'].items():<EOL><INDENT>acl = self.build_acl(tenant_name, rule)<EOL>LOG.info("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': rule_id, '<STR_LIT:name>': rule.get('<STR_LIT:name>'),<EOL>'<STR_LIT>': rule.get('<STR_LIT>'),<EOL>'<STR_LIT>': rule.get('<STR_LIT>'),<EOL>'<STR_LIT>': rule.get('<STR_LIT>'),<EOL>'<STR_LIT>': rule.get('<STR_LIT>'),<EOL>'<STR_LIT>': rule.get('<STR_LIT>'),<EOL>'<STR_LIT>': rule.get('<STR_LIT>'),<EOL>'<STR_LIT:action>': rule.get('<STR_LIT:action>')})<EOL>if rule_id in self.rule_tbl:<EOL><INDENT>cmds.append('<STR_LIT>' + self.rule_tbl[rule_id])<EOL><DEDENT>self.rule_tbl[rule_id] = acl<EOL>if tenant_name in self.tenant_rule:<EOL><INDENT>if rule_id not in self.tenant_rule[tenant_name]['<STR_LIT>']:<EOL><INDENT>self.tenant_rule[tenant_name]['<STR_LIT>'].append(rule_id)<EOL><DEDENT><DEDENT>cmds.append(acl)<EOL><DEDENT>cmds.append("<STR_LIT>" + tenant_name + "<STR_LIT>")<EOL>cmds.append("<STR_LIT>")<EOL>LOG.info("<STR_LIT>", cmds)<EOL>data = {"<STR_LIT>": cmds}<EOL>return self.rest_send_cli(data)<EOL>
Apply a firewall policy.