<?xml version="1.0" encoding="UTF-8"?>
<!--<?xml version="1.0" encoding="US-ASCII"?> -->
<!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com)
     by Daniel M Kohn (private)
-->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?rfc toc="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc subcompact="no"?>
<?rfc symrefs="yes"?>

<rfc category="std" ipr="trust200902" docName="draft-yang-i2nsf-security-policy-translation-10">

<front>
    <title abbrev="I2NSF Security Policy Translation">
        Security Policy Translation in Interface to Network Security Functions
    </title>
    
	<author initials="J." surname="Jeong" fullname="Jaehoon (Paul) Jeong">
        <organization abbrev="Sungkyunkwan University">
            Department of Computer Science and Engineering
        </organization>
        <address>
            <postal>
                <street>Sungkyunkwan University</street>
                <street>2066 Seobu-Ro, Jangan-Gu</street>
                <city>Suwon</city>
                <region>Gyeonggi-Do</region>
                <code>16419</code>
                <country>Republic of Korea</country>
            </postal>
            <phone>+82 31 299 4957</phone>
            <facsimile>+82 31 290 7996</facsimile>
            <email>pauljeong@skku.edu</email>
            <uri>http://iotlab.skku.edu/people-jaehoon-jeong.php</uri>
        </address>
    </author>

    <author initials="P." surname="Lingga" fullname="Patrick Lingga">
        <organization abbrev="Sungkyunkwan University">
            Department of Electronic, Electrical and Computer Engineering
        </organization>
        <address>
            <postal>
                <street>Sungkyunkwan University</street>
                <street>2066 Seobu-Ro, Jangan-Gu</street>
                <city>Suwon</city>
                <region>Gyeonggi-Do</region>
                <code>16419</code>
                <country>Republic of Korea</country>
            </postal>
            <phone>+82 31 299 4957</phone>
            <email>patricklink@skku.edu</email>
        </address>
    </author>

    <author initials="J." surname="Yang" fullname="Jinhyuk Yang">
        <organization abbrev="Sungkyunkwan University">
            Department of Electronic, Electrical and Computer Engineering
        </organization>
        <address>
            <postal>
                <street>Sungkyunkwan University</street>
                <street>2066 Seobu-Ro, Jangan-Gu</street>
                <city>Suwon</city>
                <region>Gyeonggi-Do</region>
                <code>16419</code>
                <country>Republic of Korea</country>
            </postal>
            <phone>+82 10 8520 8039</phone>
            <email>jin.hyuk@skku.edu</email>
        </address>
    </author>
	
    <author initials="C." surname="Chung" fullname="Chaehong Chung">
        <organization abbrev="Sungkyunkwan University">
                        Department of Electronic, Electrical and Computer Engineering
        </organization>
        <address>
            <postal>
                <street>Sungkyunkwan University</street>
                <street>2066 Seobu-Ro, Jangan-Gu</street>
                <city>Suwon</city>
                <region>Gyeonggi-Do</region>
                <code>16419</code>
                <country>Republic of Korea</country>
            </postal>
            <phone>+82 31 299 4957</phone>
            <email>darkhong@skku.edu</email>
        </address>
    </author>
  
    <date month="February" day="21" year="2022" /> 
    <area>Security</area>
    <workgroup>I2NSF Working Group</workgroup>

<!-- [rfced] Please insert any keywords (beyond those that appear in
the title) for use on http://www.rfc-editor.org/rfcsearch.html. -->

    <keyword>Internet-Draft</keyword>       
    <abstract>
        <t>
        This document proposes a scheme of security policy translation (i.e., 
        Security Policy Translator) in Interface to Network Security Functions 
        (I2NSF) Framework. When I2NSF User delivers a high-level security policy
        for a security service, Security Policy Translator in Security Controller
        translates it into a low-level security policy for Network Security 
        Functions (NSFs).
			     For this security policy translation, this document specifies the mapping 
        between a high-level security policy based on the Consumer-Facing Interface 
        YANG data model and a low-level security policy based on the NSF-Facing 
        Interface YANG data model. Also, it describes an architecture of a security
        policy translator along with an NSF database, and the process of security
        policy translation with the NSF database.
        </t>
    </abstract>
</front>

<middle>
    <section anchor="section:Introduction" title="Introduction">
        <t>
            This document defines a scheme of a security policy translation in Interface to Network Security Functions (I2NSF) Framework <xref target="RFC8329"/>. First of all, this document explains the necessity of a security policy translator (shortly called policy translator) in the I2NSF framework.
        </t>
        <t> 
            The policy translator resides in Security Controller in the I2NSF framework and translates a high-level security policy to a low-level security policy for Network Security Functions (NSFs). A high-level policy is specified by I2NSF User in the I2NSF framework and is delivered to Security Controller via Consumer-Facing Interface <xref target="I-D.ietf-i2nsf-consumer-facing-interface-dm"/>. It is translated into a low-level policy by Policy Translator in Security Controller and is delivered to NSFs to execute the rules corresponding to the low-level policy via NSF-Facing Interface <xref target="I-D.ietf-i2nsf-nsf-facing-interface-dm"/>.
        </t>
    </section>

    <section anchor="section:Terminology" title="Terminology">
        <t>
            This document uses the terminology specified in <xref target="RFC8329"/>.
        </t>
    </section>

    <section anchor="section:Necessity-for-Translator" title="Necessity for Security Policy Translator">
        <t>
            Security Controller acts as a coordinator between I2NSF User and NSFs. Also, Security Controller has capability information of NSFs that are registered via Registration Interface <xref target="I-D.ietf-i2nsf-registration-interface-dm"/> by Developer's Management System <xref target="RFC8329"/>. As a coordinator, Security Controller needs to generate a low-level policy in the form of security rules intended by the high-level policy, which can be understood by the corresponding NSFs.
        </t>
        <t>
            A high-level security policy is specified by RESTCONF/YANG <xref target="RFC8040"/><xref target="RFC6020"/>, and a low-level security policy is specified by NETCONF/YANG <xref target="RFC6241"/><xref target="RFC6020"/>. The translation from a high-level security policy to the corresponding low-level security policy will be able to rapidly elevate I2NSF in real-world deployment. A rule in a high-level policy can include a broad target object, such as employees in a company for a security service (e.g., firewall and web filter). Such employees may be from human resource (HR) department, software engineering department, and advertisement department. A keyword of employee needs to be mapped to these employees from various departments. This mapping needs to be handled by a security policy translator in a flexible way while understanding the intention of a policy specification. Let us consider the following two policies:
        </t>

        <t>
            <list style="symbols">
                <t> Block my son&apos;s computers from malicious websites. </t>
                <t> Drop packets from the IP address 10.0.0.1 and 10.0.0.3 to harm.com and illegal.com </t>
            </list>
			The above two sentences are examples of policies for blocking malicious websites. Both policies are for the same operation. However, NSF cannot understand the first policy, because the policy does not have any specified information for NSF. To set up the policy at an NSF, the NSF MUST receive at least the source IP address and website address for an operation. It means that the first sentence is NOT compatible for an NSF policy.
            Conversely, when I2NSF Users request a security policy to the system, they never make a security policy like the second example. For generating a security policy like the second sentence, the user MUST know that the NSF needs to receive the specified information, source IP address and website address. It means that the user understands the NSF professionally, but there are not many professional users in a small size of company or at a residential area.
            In conclusion, the I2NSF User prefers to issue a security policy in the first sentence, but an NSF will require the same policy as the second sentence with specific information. Therefore, an advanced translation scheme of security policy is REQUIRED in I2NSF.
        </t>
        <t>
            This document proposes an approach using Automata theory <xref target="Automata" /> for the policy translation, such as Deterministic Finite Automaton (DFA) and Context Free Grammar (CFG). Note that Automata theory is the foundation of programming language and compiler. Thus, with this approach, I2NSF User can easily specify a high-level security policy that will be enforced into the corresponding NSFs with a compatibly low-level security policy with the help of Security Policy Translator. Also, for easy management, a modularized translator structure is proposed.
        </t>
    </section>

    <section anchor="section:Design-for-Translator" title="Design of Security Policy Translator">
        <t>
            Commonly used security policies are created as XML(Extensible Markup Language) <xref target="XML" /> files. A popular way to change the format of an XML file is to use an XSLT (Extensible Stylesheet Language Transformation) <xref target="XSLT" /> document. XSLT is an XML-based language to transform an input XML file into another output XML file. However, the use of XSLT makes it difficult to manage the security policy translator and to handle the registration of new capabilities of NSFs. With the necessity for a security policy translator, this document describes a security policy translator based on Automata theory.
        </t>

        <section anchor="section:Structure-of-Translator" title="Overall Structure of Security Policy Translator">
            <figure anchor="figure:Overall-Translator-Structure" title="The Overall Design of Security Policy Translator">
                <artwork><![CDATA[
   +--------------------------------------------------+
   |                    I2NSF User                    |
   +------------------------+-------------------------+
                            | Consumer-Facing Interface
                            |
                High-level Security Policy
                            |
   Security Controller      V
   +------------------------+--------------------------------+
   |  Security Policy       |                                |
   |  Translator            V                                |
   |  +---------------------+----------------------------++  |
   |  |                     |                             |  |
   |  |                     V                             |  |
   |  |             +-------+--------+       +----------+ |  |
   |  |             |   DFA-based    |       |Data Model| |  |
   |  |             | Data Extractor |       |  Mapper  | |  |
   |  |             +-------+--------+       +----------+ |  |
   |  | Extracted Data from |              Mapping |      |  |
   |  |   High-Level Policy V                Model V      |  |
   |  |               +-----+-----+           +--------+  |  |
   |  |               |    Data   |<--------->| NSF DB |  |  |
   |  |               | Converter |           +--------+  |  |
   |  |               +-----+-----+                       |  |
   |  |                     |  Required Data for          |  |
   |  |                     V  Target NSFs                |  |
   |  |            +--------+---------+                   |  |
   |  |            |    CFG-based     |                   |  |
   |  |            | Policy Generator |                   |  |
   |  |            +--------+---------+                   |  |
   |  |                     |                             |  |
   |  |                     V                             |  |
   |  +---------------------+-----------------------------+  |
   |                        |                                |
   |                        V                                |
   +------------------------+--------------------------------+
                            | NSF-Facing Interface
                            |
                 Low-level Security Policy
                            |
                            V
   +------------------------+-------------------------+
   |                      NSF(s)                      |
   +--------------------------------------------------+
                ]]></artwork>
            </figure>
	        <t>
                <xref target="figure:Overall-Translator-Structure" /> shows the overall design for Security Policy Translator in Security Controller. There are four main components for Security Policy Translator: Data Extractor, Data Converter, Policy Generator, and Data Model Mapper.
            </t>
            <t>
                Extractor is a DFA-based module for extracting data from a high-level policy which I2NSF User delivered via Consumer-Facing Interface.
                Data Model Mapper creates a mapping model for mapping the elements between Consumer-Facing Interface and NSF-Facing Interface.
                Data Converter converts the extracted data to the capabilities of target NSFs for a low-level policy. 
                It refers to an NSF Database (DB) in order to convert an abstract subject or object into the corresponding concrete subject or object (e.g., IP address and website URL). 
                Policy Generator generates a low-level policy which will execute the NSF capabilities from Converter. 
            </t>
            
	    </section>

        <section anchor="section:Data-Extractor" title="DFA-based Data Extractor">
            <section anchor="section:Design-for-Extractor" title="Design of DFA-based Data Extractor">
	            <figure anchor="figure:DFA-Extractor" title="DFA Architecture of Data Extractor">
                    <artwork><![CDATA[
                          +----------+
                          | accepter |
                          +----------+
                               | ^
                        <tag 1>| |</tag 1>
                               v |
     +------------------------------------------------------+
     |                      middle 1                        |
     +------------------------------------------------------+
         | ^                 | ^                      | ^
  <tag 2>| |</tag 2>  <tag 3>| |</tag 3>  ...  <tag n>| |</tag n>
         v |                 v |                      v |
  
         ...                 ...                      ...
  
   +-------------+      +-------------+          +-------------+
   | extractor 1 |      | extractor 2 |   ...    | extractor m |
   +-------------+      +-------------+          +-------------+
        data:1               data:2                   data:m
                    ]]></artwork>
                </figure>

                <t>
                    <xref target="figure:DFA-Extractor" /> shows a design for Data Extractor in the security policy translator. If a high-level policy contains data along the hierarchical structure of the standard Consumer-Facing Interface YANG data model <xref target="I-D.ietf-i2nsf-consumer-facing-interface-dm" />, data can be easily extracted using the state transition machine, such as DFA. The extracted data can be processed and used by an NSF to understand it. Extractor can be constructed by designing a DFA with the same hierarchical structure as a YANG data model.
                </t>
                <t>
                    After constructing a DFA, Data Extractor can extract all of data in the entered high-level policy by using state transitions. Also, the DFA can easily detect the grammar errors of the high-level policy. The extracting algorithm of Data Extractor is as follows:
                    <list style="numbers">
                        <t> Start from the 'accepter' state. </t>
                        <t> Read the next tag from the high-level policy. </t>
                        <t> Transit to the corresponding state. </t>
                        <t> If the current state is in 'extractor', extract the corresponding data, and then go back to step 2. </t>
                        <t> If the current state is in 'middle', go back to step 2. </t>
                        <t> If there is no possible transition and arrived at &apos;accepter&apos; state, the policy has no grammar error. Otherwise, there is a grammar error, so stop the process with failure. </t>
                    </list>
                </t>
            </section>

            <section anchor="section:Example-Scenario-for-Extractor" title="Example Scenario for Data Extractor">
                <figure anchor="figure:High-level-Example" title="The Example of High-level Policy">
                    <artwork><![CDATA[
  <i2nsf-cfi-policy
    xmlns="urn:ietf:params:xml:ns:yang:ietf-i2nsf-cfi-policy">
    <name>block_web_security_policy</name>
    <rules>
      <name>block_web</name>
      <condition>
        <firewall-condition>
          <source>Son's_PC</source>
        <firewall-condition>
        <url-condition>
          <url-name>malicious_websites</url-name>
        </url-condition>
      </condition>
      <actions>
        <primary-action>
          <action>drop</action>
        </primary-action>
      </actions>
    </rules>
  </i2nsf-cfi-policy>
                ]]></artwork>
                </figure>

                <figure anchor="figure:DFA-Extractor-Example" title="The Example of Data Extractor">
                    <artwork><![CDATA[
                        +----------+
                        | accepter |
                        +----------+
                             | ^
           <i2nsf-cfi-policy>| |</i2nsf-cfi-policy>
                             v |
    +------------------------------------------------------+
    |                      middle 1                        |
    +------------------------------------------------------+
       | ^                               | ^
 <name>| |</name>                        | |
       v |                               | |
 +-------------+                 <rules> | | </rules>
 | extractor 1 |                         | |
 +-------------+                         | |
 block_web_security                      | |
 _policy                                 v |
    +------------------------------------------------------+
    |                  middle 2                            |
    +------------------------------------------------------+
       | ^                   | ^                       | ^
 <name>| |</name> <condition>| | <condition>  <actions>| |</actions>
       v |                   v |                       v |
 +-------------+  +--------------------------+   +-------------+
 | extractor 2 |  |       middle 3           |   |   middle 6  |
 +-------------+  +--------------------------+   +-------------+
    block_web       | ^                  | ^            | ^
                    | |       <url-      | |</url-      | |
                    | |        condition>| | conition>  | |
                    | |                  | |            | |
         <firewall- | |</firewall-       | |   <primary-| |</primary
          condition>| | condition>       | |     action>| | action>
                    v |                  v |            v |
              +-------------+   +-------------+   +-------------+
              |   middle 4  |   |   middle 5  |   |   middle 7  |
              +-------------+   +-------------+   +-------------+
                 | ^                  | ^                | ^     
         <source>| |</source>   <url- | |</url-  <action>| |</action>
                 | |             name>| | name>          | |
                 v |                  v |                v |
              +-------------+   +-------------+    +-------------+
              | extractor 3 |   | extractor 4 |    | extractor 5 |
              +-------------+   +-------------+    +-------------+
                 Son's_PC      malicious_websites        drop

                     ]]></artwork>
                </figure>

                <t>
                    To explain the Data Extractor process by referring to an example scenario, assume that Security Controller received a high-level policy for a web-filtering as shown in <xref target="figure:High-level-Example" />. Then we can construct DFA-based Data Extractor by using the design as shown in <xref target="figure:DFA-Extractor" />. <xref target="figure:DFA-Extractor-Example" /> shows the architecture of Data Extractor that is based on the architecture in <xref target="figure:DFA-Extractor" /> along with the input high-level policy in <xref target="figure:High-level-Example" />. Data Extractor can automatically extract all of data in the high-level policy according to the following process:

                    <list style="numbers">
                      <t> Start from the &apos;accepter&apos; state. </t>
                      <t> Read the first opening tag called '&lt;i2nsf-cfi-policy&gt;', and transit to the 'middle 1' state. </t>
                      <t> Read the second opening tag called '&lt;name&gt;', and transit to the 'extractor 1' state. </t>
                      <t> The current state is an &apos;extractor&apos; state. Extract the data of 'name' field called 'block_web_security_policy'. </t>
                      <t> Read the second closing tag called '&lt;/name&gt;', and go back to the 'middle 1' state. </t>
                      <t> Read the third opening tag called '&lt;rules&gt;', and transit to the 'middle 2' state. </t>
                      <t> Read the fourth opening tag called '&lt;name&gt;', and transit to the 'extractor 2' state. </t>
                      <t> The current state is an 'extractor' state. Extract the data of 'name' field called 'block_web'. </t>
                      <t> Read the fourth closing tag called '&lt;/name&gt;', and go back to the 'middle 2' state. </t>
                      <t> Read the fifth opening tag called '&lt;condition&gt;', and transit to the 'middle 3' state. </t>
                      <t> Read the sixth opening tag called '&lt;firewall-condition&gt;', and transit to the 'middle 4' state. </t>
                      <t> Read the seventh opening tag called '&lt;source&gt;', and transit to the 'extractor 3' state. </t>
                      <t> The current state is an 'extractor' state. Extract the data of 'source' field called 'Son&apos;s_PC'. </t>
                      <t> Read the seventh closing tag called '&lt;/source&gt;', and go back to the 'middle 4' state. </t>
                      <t> Read the sixth closing tag called '&lt;/firewall-condition&gt;', and go back to the 'middle 3' state. </t>
                      <t> Read the eight opening tag called '&lt;url-condition&gt;', and transit to the 'middle 5' state. </t>
                      <t> Read the ninth opening tag called '&lt;url-name&gt;', and transit to the 'extractor 4' state. </t>
                      <t> The current state is an 'extractor' state. Extract the data of 'url-name' field called 'malicious_websites'. </t>
                      <t> Read the ninth closing tag called '&lt;/url-name&gt;', and go back to the 'middle 5' state. </t>
                      <t> Read the eight closing tag called '&lt;/url-condition&gt;', and go back to the 'middle 3' state. </t>
                      <t> Read the fifth closing tag called '&lt;/condition&gt;', and go back to the 'middle 2' state. </t>
                      <t> Read the tenth opening tag called '&lt;actions&gt;', and transit to the 'middle 6' state. </t>
                      <t> Read the eleventh opening tag called '&lt;primary-action&gt;', and transit to the 'middle 7' state. </t>
                      <t> Read the twelfth opening tag called '&lt;action&gt;', and transit to the 'extractor 5' state. </t>
                      <t> The current state is an 'extractor' state. Extract the data of 'action' field called 'drop'. </t>
                      <t> Read the twelfth closing tag called '&lt;/action&gt;', and go back to the 'middle 7' state. </t>
                      <t> Read the eleventh closing tag called '&lt;/primary-action&gt;', and go back to the 'middle 6' state. </t>
                      <t> Read the tenth closing tag called '&lt;/actions&gt;', and go back to the 'middle 2' state. </t>
                      <t> Read the third closing tag called '&lt;/rules&gt;', and go back to the 'middle 2' state. </t>
                      <t> Read the first closing tag called '&lt;/i2nsf-cfi-policy&gt;', and go back to the 'accepter' state. </t>
                      <t> There is no further possible transition, and the state is finally on 'accepter' state. There is no grammar error in <xref target="figure:High-level-Example"/> so the scanning for data extraction is finished. </t>
                    </list>
                        
                    The above process is constructed by an extracting algorithm. 
                    After finishing all the steps of the above process, Data 
                    Extractor can extract all of data in <xref target="figure:High-level-Example" />,
                    'block_web_security_policy', 'block_malicious', 'Son&apos;s_PC', 'malicious_websites', and 'drop'.
                </t>
                <t>
                    Since the translator is modularized into a DFA structure, a visual understanding is feasible. Also, the performance of Data Extractor is excellent compared to one-to-one searching of data for a particular field. In addition, the management is efficient because the DFA completely follows the hierarchy of Consumer-Facing Interface. If I2NSF User wants to modify the data model of a high-level policy, it only needs to change the connection of the relevant DFA node.
                </t>
            </section>
        </section>
     
        <section anchor="section:Data-Converter" title="Data Converter">
          <section title="Role of Data Converter">
              <t>
                  Every NSF has its own unique capabilities. The capabilities of an NSF are registered into Security Controller by a Developer's Management System, which manages the NSF, via Registration Interface. Therefore, Security Controller already has all information about the capabilities of NSFs. This means that Security Controller can find target NSFs with only the data (e.g., subject and object for a security policy) of the high-level policy by comparing the extracted data with all capabilities of each NSF. This search process for appropriate NSFs is called by policy provisioning, and it eliminates the need for I2NSF User to specify the target NSFs explicitly in a high-level security policy.
              </t>
              <t>
                  Data Converter selects target NSFs and converts the extracted data into the capabilities of selected NSFs. If Security Controller uses this data convertor, it can provide the policy provisioning function to I2NSF User automatically. Thus, the translator design provides big benefits to the I2NSF Framework.
              </t>
          </section>

        <section anchor="section:nsf-database" title="NSF Database">
          <t>
            The NSF Database contains all the information needed to convert high-level policy data to low-level policy data. The contents of NSF Database are classified as the following two: "endpoint information" and "NSF capability information".
          </t>
          <t>
            The first is "endpoint information". Endpoint information is necessary to convert an abstract high-level policy data such as Son's_PC, malicious to a specific low-level policy data such as 10.0.0.1, illegal.com. In the high-level policy, the range of endpoints for applying security policy MUST be provided abstractly. Thus, endpoint information is needed to specify the abstracted high-level policy data. Endpoint information is provided by I2NSF User as the high-level policy through Consumer-Facing Interface, and Security Controller builds NSF Database based on received information.
          </t>
          <t>
            The second is "NSF capability information". Since capability is information that allows NSF to know what features it can support, NSF capability information is used in policy provisioning process to search the appropriate NSFs through the security policy. NSF capability information is provided by Developer's Management System (DMS) through Registration Interface, and Security Controller builds NSF Database based on received information. In addition, if the NSF sends monitoring information such as initiating information to Security Controller through NSF-Facing Interface, Security Controller can modify NSF Database accordingly.
          </t>
                <figure anchor="figure:Entity-Relationship-Diagram" title="Entity-Relationship Diagram of NSF Database">
                    <artwork><![CDATA[
  NSF Capability Information                   Endpoint Information
  +-------------------+   has        convert   +------------------+
  |        NSF        +||---+        +-------||+     Endpoint     |
  +-------------------+     |        |         +------------------+
  | *nsf_id   (INT)   |     |        |         | *end_id (INT)    |
  | nsf_name  (STRING)|     |        |         | keyword (STRING) |
  | inbound   (INT)   |     |        |         +------------------+
  | outbound  (INT)   |     |        |
  | bandwidth (INT)   |     |        |
  | activated (BOOL)  |     |        |
  +-------------------+     |        |
            +---------------+        |        +---------------------+
           /|\                       +------||+ Mapping Information |
  +--------------------+   has       |        +---------------------+
  |     Capability     +||---+       |        | *element_id (INT)   |
  +--------------------+     |       |        | element_name(STR)   |
  | *capa_id   (INT)   |     |       |        | element_map (STR)   |
  | capa_name  (STRING)|     |       |        +---------------------+
  | capa_index (INT)   |     |       |
  +--------------------+     |       |
                            /|\     /|\
                     +-----------------------+
                     |         Field         |
                     +-----------------------+
                     | *field_id   (INT)     |
                     | field_name  (STRING)  |
                     | field_index (INT)     |				   
                     | mapped_data (STRING)  |
                     +-----------------------+
                    ]]></artwork>
                </figure>
          <t>
            <xref target="figure:Entity-Relationship-Diagram" /> shows an Entity-Relationship Diagram (ERD) of NSF Database designed to include both endpoint information received from I2NSF User and NSF capability information received from DMS. By designing the NSF database based on the ERD, all the information necessary for security policy translation can be stored, and the network system administrator can manage the NSF database efficiently. 
          </t>
          <t>
            ERD was expressed by using Crow's Foot notation. Crow's Foot notation represents a relationship between entities as a line and represents the cardinality of the relationship as a symbol at both ends of the line. Attributes prefixed with * are key values of each entity. A link with two vertical lines represents one-to-one mapping, and a bird-shaped link represents one-to-many mapping. An NSF entity stores the NSF name (nsf_name), NSF specification (inbound, outbound, bandwidth), and NSF activation (activated). A Capability entity stores the capability name (capa_name) and the index of the capability field in a Registration Interface Data Model (capa_index). An Endpoint entity stores the keyword of abstract data conversion from I2NSF User (keyword). A Field entity stores the field name (field_name), the index of the field index in an NSF-Facing Interface Data Model, and converted data by referring to the Endpoint entity and a 'convert' relationship. 
          </t>
        </section>

        <section anchor="section:Data-Conversion" title="Data Conversion in Data Converter">
                <figure anchor="figure:Data-Converter-Process" title="Example of Data Conversion">
                    <artwork><![CDATA[
   High-level                           Low-level
   Policy Data                          Policy Data
+---------------+                    +------------------------------+
|  Policy Name  |                    |  Policy Name                 |
| +-----------+ | The same value     |  +-------------------------+ |
| | block_web |-|------------------->|->|block_web_security_policy| |
| | _security | |                    |  +-------------------------+ |
| |  _policy  | |                    |                              |
| +-----------+ |                    |                              |
|               |                    |                              |
|  Rule Name    |                    |  Rule Name                   |
| +-----------+ | The same value     |  +-------------------------+ |
| | block_web |-|------------------->|->|        block_web        | |
| +-----------+ |                    |  +-------------------------+ |
|               |                    |                              |
|    Source     | Conversion into    |  Source IPv4 Range           |
| +-----------+ | User's IP address  |  +-------------------------+ |
| | Son's_PC  |-|------------------->|->| Start: 10.0.0.1         | |
| |-----------+ |                    |  | End  : 10.0.0.3         | |
|               |                    |  +-------------------------+ |
|               |                    |                              |
|  URL Name     | Conversion into    |  URL - User Defined          |
| +-----------+ | malicious websites |  +-------------------------+ |
| | malicious |-|------------------->|->|       [harm.com,        | |
| | _websites | |                    |  |       illegal.com]      | |
| +-----------+ |                    |  +-------------------------+ |
|               |                    |                              |
|    Action     | Conversion into    |   Action                     |
| +-----------+ | NSF Capability     |  +-----------+               |
| |   drop    |-|------------------->|->|drop/reject|               |
| +-----------+ |                    |  +-----------+               |
+---------------+                    +------------------------------+
                    ]]></artwork>
                </figure>

          <t>
            <xref target="figure:Data-Converter-Process" /> shows an example for describing a data conversion in Data Converter. High-level policy data MUST be converted into low-level policy data which are compatible with NSFs. If a system administrator attaches a database to Data Converter, it can convert contents by referring to the database with SQL queries. Data conversion in <xref target="figure:Data-Converter-Process" /> is based on the following list:
            <list style="symbols">
              <t> 'Policy Name' and 'Rule Name' fields do NOT need the conversion. </t>
              <t> 'Source' field SHOULD be converted into a range (start and end) of IPv4 addresses. </t>
              <t> 'URL Name' field SHOULD be converted into a URL list of malicious websites. </t>
              <t> 'Action' field SHOULD be converted into the corresponding action(s) in NSF capabilities. </t>
            </list>
          </t>
        </section>

        <section anchor="section:Data-Model-Mapper" title="Data Model Mapper">
          <t>
            When translating a policy, the mapping between each element
            of the data models are necessary to properly convert the data.
            The Data Model Mapper create a mapping model between the 
            elements in Consumer-Facing Interface Data Model and 
            NSF-Facing Interface Data Model. Each element in the 
            Consumer-Facing Interface Policy Data Model has at least
            one or more corresponding element in NSF-Facing Interface 
            Data Model.
          </t>

          <t>
            <xref target="figure:mapping-list" /> shows a mapping list of data fields between Consumer-Facing Interface Data Model and NSF-Facing Interface Data Model. <xref target="figure:mapping-list" /> describes the process of passing the data value to the appropriate data field of the Data Model in detail after the data conversion.
          </t>

                <figure anchor="figure:mapping-list" title="Mapping Information for Data Conversion">
                    <artwork><![CDATA[
#policy name mapping
/consumer-facing/i2nsf-cfi-policy/name
    -> mapping: /nsf-facing/i2nsf-security-policy
                /name

#rule name mapping
/consumer-facing/i2nsf-cfi-policy/rules/name
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/name

#time mapping
/consumer-facing/i2nsf-cfi-policy/
/rules/event/time/start-date-time
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/event/time/start-date-time

/consumer-facing/i2nsf-cfi-policy/
/rules/event/time/end-date-time
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/event/time/end-date-time

/consumer-facing/i2nsf-cfi-policy/
/rules/event/time/period/day
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/event/time/period/day

/consumer-facing/i2nsf-cfi-policy/
/rules/event/time/period/date
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/event/time/period/date

/consumer-facing/i2nsf-cfi-policy/
/rules/event/time/period/month
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/event/time/period/month

/consumer-facing/i2nsf-cfi-policy/
/rules/event/time/frequency
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/event/time/frequency

#firewall-condition source target reference and mapping
/consumer-facing/i2nsf-cfi-policy/rules/condition
/firewall-condition/source
    -> reference: /consumer-facing/policy
                  /endpoint-group/user-group/name
    -> reference: /consumer-facing/policy
                  /endpoint-group/device-group/name
        -> extract: /consumer-facing/policy
                    /endpoint-group/user-group/mac-address
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ethernet
                        /source-mac-address
        -> extract: /consumer-facing/policy
                    /endpoint-group/user-group/ip-address
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv4
                        /source-ipv4-network
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv4
                        /source-ipv4-range
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv6
                        /source-ipv6-network
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv6
                        /source-ipv6-range

#firewall-condition destination target reference and mapping
/consumer-facing/i2nsf-cfi-policy/rule/condition
/firewall-condition/destination
    -> reference: /consumer-facing/policy
                  /endpoint-group/user-group/name
    -> reference: /consumer-facing/policy
                  /endpoint-group/device-group/name
        -> extract: /consumer-facing/policy
                    /endpoint-group/user-group/mac-address
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ethernet
                        /destination-mac-address
        -> extract: /consumer-facing/policy
                    /endpoint-group/user-group/ip-address
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv4
                        /destination-ipv4-network
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv4
                        /destination-ipv4-range
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv6
                        /destination-ipv6-network
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv6
                        /destination-ipv6-range
                        
#ddos-condition threshold mapping
/consumer-facing/i2nsf-cfi-policy/rules/condition
/ddos-condition/packet-rate-threshold
    -> mapping: /nsf-facing/i2nsf-security-policy/rules/condition
                /ddos/alert-packet-rate
                
/consumer-facing/i2nsf-cfi-policy/rules/condition
/ddos-condition/packet-byte-threshold
    -> mapping: /nsf-facing/i2nsf-security-policy/rules/condition
                /ddos/alert-byte-rate
                
/consumer-facing/i2nsf-cfi-policy/rules/condition
/ddos-condition/flow-rate-threshold
    -> mapping: /nsf-facing/i2nsf-security-policy/rules/condition
                /ddos/alert-flow-rate

#payload-condition mapping
/consumer-facing/i2nsf-cfi-policy/rules/condition
/payload-condition/content
    -> reference: /consumer-facing/i2nsf-cfi-policy
                  /threat-prevention/payload-content/name
        -> extract: /consumer-facing/i2nsf-cfi-policy
                    /threat-prevention/payload-content/content
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/payload/content
                        
#voice-condition mapping
/consumer-facing/i2nsf-cfi-policy/rules/condition
/voice-condition/source-id
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/condition/voice
                /source-voice-id
                
/consumer-facing/i2nsf-cfi-policy/rules/condition
/voice-condition/destination-id
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/condition/voice
                /destination-voice-id

/consumer-facing/i2nsf-cfi-policy/rules/condition
/voice-condition/user-agent
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/condition/voice
                /user-agent
                              
#geographic-location mapping
/consumer-facing/i2nsf-cfi-policy/rules/condition/context
/geographic-location/source
    -> reference: /consumer-facing/i2nsf-cfi-policy
                  /endpoint-groups/location-group/name
        -> extract: /consumer-facing/i2nsf-cfi-policy
                    /endpoint-groups/location-group
                    /geo-ip-ipv4/ipv4-address
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv4
                        /source-ipv4-network
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv4
                        /source-ipv4-range
        -> extract: /consumer-facing/i2nsf-cfi-policy
                    /endpoint-groups/location-group
                    /continent
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/context
                        /geographic-location/source

/consumer-facing/i2nsf-cfi-policy/rules/condition/context
/geographic-location/destination
    -> reference: /consumer-facing/i2nsf-cfi-policy
                  /endpoint-groups/location-group/name
        -> extract: /consumer-facing/i2nsf-cfi-policy
                    /endpoint-groups/location-group
                    /geo-ip-ipv4/ipv4-address
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv4
                        /destination-ipv4-network
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/ipv4
                        /destination-ipv4-range
        -> extract: /consumer-facing/i2nsf-cfi-policy
                    /endpoint-groups/location-group
                    /continent
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/context
                        /geographic-location/destination

#url-condition mapping
/consumer-facing/i2nsf-cfi-policy/rules/condition
/url-condition/url-name
    -> reference: /consumer-facing/i2nsf-cfi-policy
                  /endpoint-groups/url-group/name
        -> extract: /consumer-facing/i2nsf-cfi-policy
                    /endpoint-groups/url-group/url
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/url-category
                        /pre-defined
            -> mapping: /nsf-facing/i2nsf-security-policy
                        /rules/condition/url-category
                        /user-defined

#rule action name mapping
/consumer-facing/i2nsf-cfi-policy/rules/actions/primary-action
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/action
                /packet-action/ingress-action
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/action
                /packet-action/egress-action
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/action
                /advanced-action/content-security-control
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/action
                /advanced-action/attack-mitigation-control
                
/consumer-facing/i2nsf-cfi-policy/rules/actions/secondary-action
    -> mapping: /nsf-facing/i2nsf-security-policy
                /rules/action/packet-action/log-action
                    ]]></artwork>
                </figure>
                
        <t>
          The mapping list shown in the <xref target="figure:mapping-list" /> shows all mapped components.
          This data list should be saved into the NSF Database to provide the mapping information for converting the data.
          It is important to produce the list automatically as the Consumer-Facing Interface and NSF-Facing Interface can be extended anytime by vendors according to the provided NSF.
          The Data Model Mapper in Security Policy Translator should be used to produce the mapping model information automatically.
          
        </t>
          <figure anchor="figure:mapper" title="Data Model Mapping">
           <artwork><![CDATA[
    
    Consumer-Facing Interface          NSF-Facing Interface
         YANG Data Model                  YANG Data Model
                |                               |
                V                               V
      +---------+-------------------------------+------+
      |         |       Data Model Mapper       |      |
      |         |                               |      |
      |         |  +-------------------------+  |      |
      |         +->| Convert as a Tree Graph |<-+      |
      |            +------------+------------+         |
      |                         |                      |
      |                         v                      | 
      |          +----------------------------+        |
      |          | Calculate each element     |        |
      |          | Tree Edit Distance         |        |
      |          | between the CFI and NFI    |        |
      |          +--------------+-------------+        |
      |                         |                      |
      |                         v                      |
      |            +-------------------------+         |
      |            |  Get the elements with  |         |
      |            |  smallest distance as   |         |
      |            |  the candidates         |         |
      |            +-------------------------+         |
      |                         |                      |
      +-------------------------+----------------------+
                                |
                                V
                  Data Model Mapping Information

Note
CFI: Consumer-Facing Interface
NFI: NSF-Facing Interface

            ]]></artwork>
          </figure>
          
          <t>
            <xref target="figure:mapper"/> shows the mapping for I2NSF Security Policy Translator.
            The mapper uses the Consumer-Facing Interface and NSF-Facing Interface YANG Data Model as inputs.
            The process the Data Model and converts it into a Tree Graph.
            Tree Graph is used to proces the Data Model as a Tree instead of individual elements.
            Then the Data Model Mapper calculates the Tree Edit Distance between each element in Consumer-Facing Interface and each element in NSF-Facing Interface.
            The Tree Edit Distance can be calculated with an algorithm, e.g., Zhang-Shasha algorithm <xref target="Zhang-Shasha"/>, with the calculation should start from the root of the tree.

          </t>
          
          <t>
            The Zhang-Shasha calculates the distance by three operations:
            <list style="number">
              <t>Insert: Inserting a node or element</t>
              <t>Delete: Deleting a node or element</t>
              <t>Change: Change the label of a node or element to another</t>
            </list>
          </t>
          
          <t>
            The insert and delete operations are a simple of adding/deleting a node or element with the length of the label of the node.
            The change operation must be calculated between the label of the element to produce the distance.
            There are methods to calculate this, such as Levenshtein Distance, Cosine Similarity, or Sequence Matching.
            For this data model mapper, cosine similarity should be the best choice as it measures the similarity between words.
            The data models have similarity between words and it can helps in calculating as minimum distance as possible.
          </t>
          
          <t>
            When the minimum distance is obtained, the NSF-Facing Interface element is saved as the candidates for mapping the Consumer-Facing Interface element.
            This information should be saved to the NSF Database for the Data Converter.
          </t>
          <t>
            Do note that the proper mapping can be achieved because the similarity between the Consumer-Facing Interface and NSF-Facing Interface.
            An extension created for the Consumer-Facing Interface and NSF-Facing Interface should keep the close similarity relationship between the data models to be able to produce the mapping model information automatically.
          </t>
        </section>



            <section title="Policy Provisioning">
                <figure anchor="figure:Policy-Provisioning" title="Example of Policy Provisioning">
                    <artwork><![CDATA[
      Log-keeper              Low-level              Web-filter
         NSF                 Policy Data                NSF
+-------------------+  +--------------------+  +-------------------+
|    Policy Name    |  |     Policy Name    |  |     Policy Name   |
| +--------------+  |  |  +--------------+  |  |  +--------------+ |
| | block_web    |<-|<-|<-| block_web    |->|->|->| block_web    | |
| | _security    |  |  |  | _security    |  |  |  | _security    | |
| | _policy      |  |  |  | _policy      |  |  |  | _policy      | |
| +--------------+  |  |  +--------------+  |  |  +--------------+ |
|                   |  |                    |  |                   |
|    Rule Name      |  |     Rule Name      |  |     Rule Name     |
| +--------------+  |  |  +--------------+  |  |  +--------------+ |
| |  block_web   |<-|<-|<-|   block_web  |->|->|->|   block_web  | |
| +--------------+  |  |  +--------------+  |  |  +--------------+ |
|                   |  |                    |  |                   |
|   Source IPv4     |  |    Source IPv4     |  |    Source IPv4    |
| +--------------+  |  |  +--------------+  |  |  +--------------+ |
| |Start:10.0.0.1|<-|<-|<-|Start:10.0.0.1|->|->|->|Start:10.0.0.1| |
| |End  :10.0.0.3|  |  |  |End  :10.0.0.3|  |  |  |End  :10.0.0.3| |
| +--------------+  |  |  +--------------+  |  |  +--------------+ |
|                   |  |                    |  |                   |
|                   |  | URL - User Defined |  | URL - User Defined|
|                   |  |  +--------------+  |  |  +--------------+ |
|                   |  |  |  [harm.com,  |->|->|->|  [harm.com,  | |
|                   |  |  | illegal.com] |  |  |  | illegal.com] | |
|                   |  |  +--------------+  |  |  +--------------+ |
|                   |  |                    |  |                   |
|    Log Action     |  |     Log Action     |  |                   |
| +--------------+  |  |  +--------------+  |  |                   |
| |     True     |<-|<-|<-|     True     |  |  |                   |
| +--------------+  |  |  +--------------+  |  |                   |
+-------------------+  |                    |  |                   |
                       |       Action       |  |       Action      |
                       |  +--------------+  |  |  +--------------+ |
                       |  |     Drop     |->|->|->|  Drop/Reject | |
                       |  +--------------+  |  |  +--------------+ |
                       +--------------------+  +-------------------+
                    ]]></artwork>
                </figure>
                <t>
                    Generator searches for proper NSFs which can cover
                    all of capabilities in the high-level policy. 
                    Generator searches for target NSFs by comparing 
                    only NSF capabilities which is registered by 
                    Vendor Management System. This process is called 
                    by &quot;policy provisioning&quot; because Generator
                    finds proper NSFs by using only the policy. If 
                    target NSFs are found by using other data which 
                    is not included in a user&apos;s policy, it means
                    that the user already knows the specific knowledge
                    of an NSF in the I2NSF Framework. 
                    <xref target="figure:Policy-Provisioning" /> shows
                    an example of policy provisioning. In this example, 
                    log-keeper NSF and web-filter NSF are selected for 
                    covering capabilities in the security policy. All 
                    of capabilities can be covered by two selected NSFs.
                </t>
            </section>

        </section>

        <section anchor="section:CFG-Generator" title="CFG-based Policy Generator">
            <t>
                Generator makes low-level security policies for each target NSF with the extracted data. We constructed Generator by using Context Free Grammar (CFG). CFG is a set of production rules which can describe all possible strings in a given formal language(e.g., programming language). The low-level policy also has its own language based on a YANG data model of NSF-Facing Interface. Thus, we can construct the productions based on the YANG data model. The productions that makes up the low-level security policy are categorized into two types, 'Content Production' and 'Structure Production'.
            </t>
            <t>
                  
            </t>

            <section anchor="section:Content-Production" title="Content Production">
                <t>
                    Content Production is for injecting data into low-level policies to be generated. A security manager(i.e., a person (or software) to make productions for security policies) can construct Content Productions in the form of an expression as the following productions:

                    <list style="symbols">
                        <t>[cont_prod] -> [cont_prod][cont_prod] (Where duplication is allowed.)</t>
                        <t>[cont_prod] -> &lt;cont_tag&gt;[cont_data]&lt;/cont_tag&gt;</t>
                        <t>[cont_data] -> data_1 | data_2 | ... | data_n</t>
                    </list>

                    Square brackets mean non-terminal state. If there are no non-terminal states, it means that the string is completely generated. When the duplication of content tag is allowed, the security manager adds the first production for a rule. If there is no need to allow duplication, the first production can be skipped because it is an optional production.
                </t>
                <t>
                    The second production is the main production for Content Production because it generates the tag which contains data for low-level policy. Last, the third production is for injecting data into a tag which is generated by the second production. If data is changed for an NSF, the security manager needs to change &quot;only the third production&quot; for data mapping in each NSF.
                </t>
                <t>
                    For example, if the security manager wants to express a low-level policy for URL, Content Production can be constructed in the following productions:

                    <list style="symbols">
                      <t>[cont_url] -> [cont_url][cont_url] (Allow duplication)</t>
                      <t>[cont_url] -> &lt;user-defined&gt;[cont_url_data]&lt;/url-defined&gt;</t>
                      <t>[cont_url_data] -> harm.com | illegal.com</t>
                    </list>
                </t>
            </section>
            <section anchor="section:Structure-Production" title="Structure Production">
                <t>
				    Structure Production is for grouping other tags into a hierarchy. The security manager can construct Structure Production in the form of an expression as the following production:

                    <list style="symbols">
                        <t>[struct_prod] -> &lt;struct_tag&gt;[prod_1]...[prod_n]&lt;/struct_tag&gt;</t>
                    </list>

                    Structure Production can be expressed as a single production. The above production means to group other tags by the name of a tag which is called by 'struct_tag'. [prod_x] is a state for generating a tag which wants to be grouped by Structure Production. [prod_x] can be both Content Production and Structure Production. For example, if the security manager wants to express the low-level policy for the I2NSF tag, which is grouping 'name' and 'rules', Structure Production can be constructed as the following production where [cont_name] is the state for Content Production and [struct_rule] is the state for Structure Production.

                    <list style="symbols">
                        <t>[struct_i2nsf] -> &lt;i2nsf-security-policy&gt;[cont_name][struct_rules]&lt;/i2nsf-security-policy&gt;</t>
                    </list>
                </t>
            </section>

            <section anchor="section:Generator-Construction" title="Generator Construction">
                <t>
                    The security manager can build a generator by combining the two productions which are described in <xref target="section:Content-Production" /> and <xref target="section:Structure-Production" />. <xref target="figure:Generator-Tree" /> shows the CFG-based Generator construction of the web-filter NSF. It is constructed based on the NSF-Facing Interface Data Model in <xref target="I-D.ietf-i2nsf-nsf-facing-interface-dm" />. According to <xref target="figure:Generator-Tree" />, the security manager can express productions for each clause as in following CFG:
                    <list style="numbers">
            <!--01--> <t>[cont_policy_name] -> &lt;name&gt;[cont_policy_name_data]&lt;/name&gt;</t> 
            <!--02--> <t>[cont_policy_name_data] -> block_web_security_policy</t>
            <!--03--> <t>[cont_rule_name] -> &lt;name&gt;[cont_rule_name_data]&lt;/name&gt;</t>
            <!--04--> <t>[cont_rule_name_data] -> block_web</t>
            <!--05--> <t>[cont_ipv4_start] -> &lt;start&gt;[cont_ipv4_start_data]&lt;/start&gt;</t>
            <!--06--> <t>[cont_ipv4_start_data] -> 10.0.0.1</t>
            <!--07--> <t>[cont_ipv4_end] -> &lt;end&gt;[cont_ipv4_end_data]&lt;/end&gt;</t>
            <!--08--> <t>[cont_ipv4_end_data] -> 10.0.0.3</t>
            <!--09--> <t>[cont_url] -> [cont_url][cont_url] (Allow duplication)</t>
            <!--10--> <t>[cont_url] -> &lt;user-defined&gt;[cont_url_data]&lt;/user-defined&gt;</t>
            <!--11--> <t>[cont_url_data] -> harm.com | illegal.com</t>
            <!--12--> <t>[cont_action] -> &lt;packet-action&gt;[cont_action_data]&lt;/packet-action&gt;</t>
            <!--13--> <t>[cont_action_data] -> drop</t>
            <!--14--> <t>[struct_src_ipv4_range] -> &lt;source-ipv4-range&gt;[cont_ipv4_start][cont_ipv4_end]&lt;source-ipv4-range&gt;</t>
            <!--15--> <t>[struct_ipv4] -> &lt;ipv4&gt;[struct_src_ipv4_range]&lt;/ipv4&gt;</t>
            <!--16--> <t>[struct_url] -> &lt;url-category&gt;[cont_url]&lt;/url-category&gt;</t>
            <!--17--> <t>[struct_cond] -> &lt;condition&gt;[struct_ipv4][struct_url]&lt;/condition&gt;</t>
            <!--18--> <t>[struct_action] -> &lt;action&gt;[cont_action]&lt;/action&gt;</t>
            <!--19--> <t>[struct_rules] -> &lt;rules&gt;[cont_rule_name][struct_cond][struct_action]&lt;/rules&gt;</t>
            <!--20--> <t>[struct_i2nsf] -> &lt;i2nsf-security-policy&gt;[cont_policy_name][struct_rules]&lt;/i2nsf-security-policy&gt;</t>
                    </list>

                    Then, Generator generates a low-level policy by using the above CFG. The low-level policy is generated by the following process:
                    <list style="numbers">
                      <t>Start: [struct_i2nsf]</t>
                      <t>Production 20: &lt;i2nsf-security-policy&gt;[cont_policy_name][struct_rules]&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 1: &lt;i2nsf-security-policy&gt;&lt;name&gt;[cont_policy_name_data]&lt;/name&gt;[struct_rules]&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 2: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;[struct_rules]&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 19: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;[cont_rule_name][struct_cond][struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 3: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;[cont_rule_name_data]&lt;/name&gt;[struct_cond][struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 4: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;[struct_cond][struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 17: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;[struct_ipv4][struct_url]&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 15: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;[struct_src_ipv4_range]&lt;/ipv4&gt;[struct_url]&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 14: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;[cont_ipv4_start][cont_ipv4_end]&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;[struct_url]&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 5: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;[cont_ipv4_start_data]&lt;/start&gt;[cont_ipv4_end]&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;[struct_url]&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 6: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;[cont_ipv4_end]&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;[struct_url]&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 7: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;[cont_ipv4_end_data]&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;[struct_url]&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 8: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;10.0.0.3&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;[struct_url]&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 16: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;10.0.0.3&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;&lt;url-category&gt;[cont_url]&lt;/url-category&gt;&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 9: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;10.0.0.3&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;&lt;url-category&gt;[cont_url][cont_url]&lt;/url-category&gt;&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 10: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;10.0.0.3&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;&lt;url-category&gt;&lt;user-defined&gt;[cont_url_data]&lt;/user-defined&gt;&lt;user-defined&gt;[cont_url_data]&lt;/user-defined&gt;&lt;/url-category&gt;&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 11: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;10.0.0.3&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;&lt;url-category&gt;&lt;user-defined&gt;harm.com&lt;/user-defined&gt;&lt;user-defined&gt;illegal.com&lt;/user-defined&gt;&lt;/url-category&gt;&lt;/condition&gt;[struct_action]&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 18: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;10.0.0.3&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;&lt;url-category&gt;&lt;user-defined&gt;harm.com&lt;/user-defined&gt;&lt;user-defined&gt;illegal.com&lt;/user-defined&gt;&lt;/url-category&gt;&lt;/condition&gt;&lt;action&gt;[cont_action]&lt;/action&gt;&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 12: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;10.0.0.3&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;&lt;url-category&gt;&lt;user-defined&gt;harm.com&lt;/user-defined&gt;&lt;user-defined&gt;illegal.com&lt;/user-defined&gt;&lt;/url-category&gt;&lt;/condition&gt;&lt;action&gt;&lt;packet-action&gt;[cont_action_data]&lt;/packet-action&gt;&lt;/action&gt;&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                      
                      <t>Production 13: &lt;i2nsf-security-policy&gt;&lt;name&gt;block_web_security_policy&lt;/name&gt;&lt;rules&gt;&lt;name&gt;block_web&lt;/name&gt;&lt;condition&gt;&lt;ipv4&gt;&lt;source-ipv4-range&gt;&lt;start&gt;10.0.0.1&lt;/start&gt;&lt;end&gt;10.0.0.3&lt;/end&gt;&lt;/source-ipv4-range&gt;&lt;/ipv4&gt;&lt;url-category&gt;&lt;user-defined&gt;harm.com&lt;/user-defined&gt;&lt;user-defined&gt;illegal.com&lt;/user-defined&gt;&lt;/url-category&gt;&lt;/condition&gt;&lt;action&gt;&lt;packet-action&gt;drop&lt;/packet-action&gt;&lt;/action&gt;&lt;/rules&gt;&lt;/i2nsf-security-policy&gt;</t>
                        
                    </list>

                    The last production has no non-terminal state, and the low-level policy is completely generated. <xref target="figure:Low-Level-Policy-Example" /> shows the generated low-level policy where tab characters and newline characters are added.
                </t>

                <figure anchor="figure:Generator-Tree" title="Generator Construction for Web-Filter NSF">
                    <artwork><![CDATA[
                    
+-------------------------------------------------------------------+
|                         Content Production                        |
|                                                                   |
|  +----------+ +----------+ +----------+ +----------+ +----------+ |
|  |  Policy  | |   Rule   | |  Source  | | URL User | |   Drop   | |
|  |   Name   | |   Name   | |  Address | | Defined  | |          | |
|  +-----+----+ +-----+----+ +-----+----+ +----+-----+ +----+-----+ |
|        |            |            |           |            |       |
+---------------------------------+-----------+---------------------+
         |            |            |           |            |
         V            V            V           V            V
+---------------------+------------+-----------+------------+-------+
|        |            |            |           |            |       |
|        |            |            V           V            |       |
|        |            |      +----------+ +----------+      |       |
|        |            |      |  IPv4    | |  URL     |      |       |
|        |            |      |  Clause  | |  Clause  |      |       |
|        |            |      +-----+----+ +----+-----+      |       |
|        |            |            |           |            |       |
|        |            |            V           V            |       |
|        |            |          +---------------+    +----------+  |
|        |            |          |   Condition   |    |  Action  |  |
|        |            |          |    Clause     |    |  Clause  |  |
|        |            |          +-------+-------+    +-----+----+  |
|        |            |                  |                  |       |
|        |            V                  V                  V       |
|        |          +-----------------------------------------+     |
|        |          |               Rule Clause               |     |
|        |          +-----------------------------------------+     |
|        |                                |                         |
|        V                                V                         |
|  +----------------------------------------------------------+     |
|  |               I2NSF Security Policy Clause               |     |
|  +-----------------------------------+----------------------+     |
|                                      |                            |
|       Structure Production           |                            |
+--------------------------------------+----------------------------+
                                       |
                                       V
                                Low-Level Policy
                    ]]></artwork>
                </figure>

                <figure anchor="figure:Low-Level-Policy-Example" title="Example of Low-Level Policy">
                    <artwork><![CDATA[
      <i2nsf-security-policy>
        <name>block_web_security_policy</name>
        <rules>
          <name>block_web</name>
          <condition>
            <ipv4>
              <source-ipv4-range>
                <start>10.0.0.1</start>
                <end>10.0.0.3</end>
              </source-ipv4-range>
            </ipv4>
            <url-category>
              <user-defined>harm.com</user-defined>
              <user-defined>illegal.com</user-defined>
            </url-category>
          </condition>
          <action>
            <packet-action>drop</packet-action>
          </action>
        </rules>
      </i2nsf-security-policy>
                    ]]></artwork>
                </figure>
            </section>
        </section>
    </section>

    <section anchor="section:implementation-considerations" title="Implementation Considerations">
      <t>
        The implementation considerations in this document include the following three: "data model auto-adaptation", "data conversion", and "policy provisioning".
      </t>

      <section title="Data Model Auto-adaptation">
        <t>
          Security Controller which acts as the intermediary MUST 
          process the data according to the data model of the connected 
          interfaces. However, the data model can be changed flexibly
          depending on the situation, and Security Controller may adapt
          to the change. Therefore, Security Controller can be implemented 
          for convenience so that the security policy translator can easily
          adapt to the change of the data model.
        </t>
        <t>
          The translator constructs and uses the DFA to adapt to 
          Consumer-Facing Interface Data Model. In addition, the CFG 
          is constructed and used to adapt to NSF-Facing Interface Data 
          Model. Both the DFA and the CFG follow the same tree structure
          of YANG Data Model.
        </t>
        <t>
          The DFA starts at the node and expands operations by changing
          the state according to the input. Based on the YANG Data Model, 
          a container node is defined as a middle state and a leaf node
          is defined as an extractor node. After that, if the nodes are 
          connected in the same way as the hierarchical structure of the 
          data model, Security Controller can automatically construct 
          the DFA. The DFA can be conveniently built by investigating 
          the link structure using the stack, starting with the root 
          node.
        </t>
        <t>
          The CFG starts at the leaf nodes and is grouped into clauses 
          until all the nodes are merged into one node. A leaf node is
          defined as the content production, and a container node is 
          defined as the structure production. After that, if the nodes
          are connected in the same way as the hierarchy of the data model,
          Security Controller can automatically construct the CFG. The CFG 
          can be conveniently constructed by investigating the link structure
          using the priority queue data, starting with the leaf nodes.
        </t>
      </section>

      <section title="Data Conversion">
        <t>
          Security Controller requires the ability to materialize 
          the abstract data in the high-level security policy and 
          forward it to NSFs. Security Controller can receive endpoint 
          information as keywords through the high-level security 
          policy. At this time, if the endpoint information 
          corresponding to the keyword is mapped and the query 
          is transmitted to the NSF Database, the NSF Database 
          can be conveniently registered with necessary information 
          for data conversion. When a policy tries to establish a 
          policy through the keyword, Security Controller searches 
          the details corresponding to the keyword registered in the 
          NSF Database and converts the keywords into the appropriate 
          and specified data.
        </t>
      </section>

      <section title="Policy Provisioning">
        <t>
          This document stated that policy provisioning function is 
          necessary to enable users without expert security knowledge 
          to create policies. Policy provisioning is determined by 
          the capability of the NSF. If the NSF has information about
          the capability in the policy, the probability of selection
          increases.
        </t>
        
        <t>
          Most importantly, selected NSFs may be able to perform all 
          capabilities in the security policy. This document recommends 
          a study of policy provisioning algorithms that are highly 
          efficient and can satisfy all capabilities in the security
          policy.
        </t>
      </section>
    </section>

    <section anchor="section:Features-of-Translator" title="Features of Security Policy Translator Design">
      <t>
        First, by showing a visualized translator structure, the 
        security manager can handle various policy changes. 
        Translator can be shown by visualizing DFA and Context-free 
        Grammar so that the manager can easily understand the structure of Security Policy Translator.
      </t>
      <t>
        Second, if I2NSF User only keeps the hierarchy of the data 
        model, I2NSF User can freely create high-level policies. 
        In the case of DFA, data extraction can be performed in 
        the same way even if the order of input is changed. The 
        design of the security policy translator is more flexible 
        than the existing method that works by keeping the tag's 
        position and order exactly.
      </t>
      <t>
        Third, the structure of Security Policy Translator can be 
        updated even while Security Policy Translator is operating.
        Because Security Policy Translator is modularized, the 
        translator can adapt to changes in the NSF capability while
        the I2NSF framework is running. The function of changing the 
        translator's structure can be provided through Registration 
        Interface.
      </t>
    </section>

    <section anchor="section:Security-Considerations" title="Security Considerations">
      <t>
        There is no security concern in the proposed security policy translator as long as the I2NSF interfaces (i.e., Consumer-Facing Interface, NSF-Facing Interface, and Registration Interface) are protected by secure communication channels.
      </t>
    </section>

    <section anchor="section:IANA-Considerations" title="IANA Considerations">
	    <t>	
        This document does not require any IANA actions.
	    </t>
    </section>
  
    <section anchor="section:Ack" title="Acknowledgments">
      <t>
        This work was supported by Institute of Information &amp; Communications 
        Technology Planning &amp; Evaluation (IITP) grant funded by the Ministry 
        of Science and ICT (MSIT), Korea, (R-20160222-002755, Cloud based Security 
        Intelligence Technology Development for the Customized Security Service 
        Provisioning).
        This work was supported in part by the IITP (2020-0-00395, Standard
        Development of Blockchain based Network Management Automation Technology).
        This work was supported in part by the MSIT under the Information Technology 
        Research Center (ITRC) support program (IITP-2021-2017-0-01633) supervised by
        the IITP.		        
      </t>  
    </section>

</middle>

<back>

<references title="Normative References">
  <?rfc include="reference.RFC.6020"?>
  <?rfc include="reference.RFC.8040"?>
  <?rfc include="reference.RFC.6241"?>
  <?rfc include="reference.RFC.8329"?>
  <?rfc include="reference.I-D.ietf-i2nsf-consumer-facing-interface-dm"?>
  <?rfc include="reference.I-D.ietf-i2nsf-nsf-facing-interface-dm"?>
  <?rfc include="reference.I-D.ietf-i2nsf-registration-interface-dm"?>
</references>

<references title="Informative References">

    <reference anchor="Automata">
        <front>
            <title>Formal Languages and Automata, 6th Edition</title>
            <author initials="L." surname="Peter" />
            <date month="January" year="2016" />
        </front>
    </reference>
    
    <reference anchor="Zhang-Shasha">
        <front>
            <title>Simple Fast Algorithms for the Editing Distance Between Trees and Related Problems</title>
            <author initials="K." surname="Zhang" />
            <author initials="D." surname="Shasha" />
            <date year="1989" />
        </front>
        <seriesInfo name="SIAM J. Comput." value="https://www.researchgate.net/publication/220618233_Simple_Fast_Algorithms_for_the_Editing_Distance_Between_Trees_and_Related_Problems"/>
    </reference>

    <reference anchor="XML">
        <front>
            <title>On Views and XML (Extensible Markup Language)</title>
            <author>
                <organization>W3C</organization>
            </author>
            <date month="June" year="1999" />
        </front>
    </reference>
		
    <reference anchor="XSLT">
        <front>
            <title>Extensible Stylesheet Language Transformations (XSLT) Version 1.0</title>         
					  <author>
                <organization>W3C</organization>
            </author>
            <date month="November" year="1999" />
        </front>
    </reference>
    </references>

    <!-- START: Changes from the previous version -->
    <section title="Changes from draft-yang-i2nsf-security-policy-translation-09">
        <t>
        The following changes are made from draft-yang-i2nsf-security-policy-translation-09:

            <list style="symbols">
              <t>
                This version describes the mapping with the updated data models of
                Consumer-Facing Interface (version 16) and NSF-Facing Interface (version 21).
              </t>
            </list>
        </t>
    </section>
    <!-- END: Changes from the previous version -->
</back>

<!-- <vspace blankLines="100"/> -->
<!-- page break to put addresses onto one page-->

</rfc>
