original_docstring: Adds a spoof filter ACL on host if not already present.
  
          A spoof filter is identified by a common spoof tag mark.
          If not present create the filter on VPP, If it is present, replace
          it for good measure to ensure that the correct anti-spoof rules
          are always applied.
  
          Return: VppAcl(in_idx, out_idx)
          
docstring: Adds a spoof filter ACL on host if not already present.
  A spoof filter is identified by a common spoof tag mark.
  If not present create the filter on VPP, If it is present, replace
  it for good measure to ensure that the correct anti-spoof rules
  are always applied.
  
  
docstring_tokens: Adds a spoof filter ACL on host if not already present . A spoof filter is identified by a common spoof tag mark . If not present create the filter on VPP If it is present replace it for good measure to ensure that the correct anti - spoof rules are always applied .
code: def spoof_filter_on_host(self):
          """Adds a spoof filter ACL on host if not already present.
  
          A spoof filter is identified by a common spoof tag mark.
          If not present create the filter on VPP, If it is present, replace
          it for good measure to ensure that the correct anti-spoof rules
          are always applied.
  
          Return: VppAcl(in_idx, out_idx)
          """
          # Check if we have an existing spoof filter deployed on vpp
          spoof_acl = self.secgroups.get(COMMON_SPOOF_TAG)
          # Get the current anti-spoof filter rules. If a spoof filter is
          # present replace rules for good measure, else create a new
          # spoof filter
          spoof_filter_rules = self.get_spoof_filter_rules()
          if spoof_acl:
              in_acl_idx, out_acl_idx = spoof_acl.in_idx, spoof_acl.out_idx
          else:
              in_acl_idx = out_acl_idx = 0xffffffff
  
          in_acl_idx = self.vpp.acl_add_replace(
              acl_index=in_acl_idx,
              tag=common_spoof_tag(VPP_TO_VM),
              rules=spoof_filter_rules['ingress'])
  
          out_acl_idx = self.vpp.acl_add_replace(
              acl_index=out_acl_idx,
              tag=common_spoof_tag(VM_TO_VPP),
              rules=spoof_filter_rules['egress'])
  
          # Add the new spoof ACL to secgroups mapping if it is valid
          if (in_acl_idx != 0xFFFFFFFF
                  and out_acl_idx != 0xFFFFFFFF and not spoof_acl):
              spoof_acl = VppAcl(in_acl_idx, out_acl_idx)
              self.secgroups[COMMON_SPOOF_TAG] = spoof_acl
          return spoof_acl
code_tokens: def spoof_filter_on_host ( self ) : spoof_acl = self . secgroups . get ( COMMON_SPOOF_TAG ) spoof_filter_rules = self . get_spoof_filter_rules ( ) if spoof_acl : in_acl_idx , out_acl_idx = spoof_acl . in_idx , spoof_acl . out_idx else : in_acl_idx = out_acl_idx = 0xffffffff in_acl_idx = self . vpp . acl_add_replace ( acl_index = in_acl_idx , tag = common_spoof_tag ( VPP_TO_VM ) , rules = spoof_filter_rules [ 'ingress' ] ) out_acl_idx = self . vpp . acl_add_replace ( acl_index = out_acl_idx , tag = common_spoof_tag ( VM_TO_VPP ) , rules = spoof_filter_rules [ 'egress' ] ) if ( in_acl_idx != 0xFFFFFFFF and out_acl_idx != 0xFFFFFFFF and not spoof_acl ) : spoof_acl = VppAcl ( in_acl_idx , out_acl_idx ) self . secgroups [ COMMON_SPOOF_TAG ] = spoof_acl return spoof_acl
short_docstring: Adds a spoof filter ACL on host if not already present.
short_docstring_tokens: Adds a spoof filter ACL on host if not already present .
comment: """Adds a spoof filter ACL on host if not already present.
  
          A spoof filter is identified by a common spoof tag mark.
          If not present create the filter on VPP, If it is present, replace
          it for good measure to ensure that the correct anti-spoof rules
          are always applied.
  
          Return: VppAcl(in_idx, out_idx)
          """$SEP$# Check if we have an existing spoof filter deployed on vpp$SEP$# Get the current anti-spoof filter rules. If a spoof filter is$SEP$# present replace rules for good measure, else create a new$SEP$# spoof filter$SEP$# Add the new spoof ACL to secgroups mapping if it is valid