Skip to content

JSON schemas and examples

Baby Bender edited this page Apr 9, 2018 · 15 revisions

JSON schemas and examples

Table of Contents

  1. IPPS
  1. PPP
  1. PHS

1. IPPS

schema :

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Component",
  "description": "Packet Processing Service",
  "type": "object",
  "properties": {
    "version": {
        "description": "The unique version of component",
        "type": "string"
    },
    "log": {
        "type": "object",
        "properties": {
            "dir_location": {
                "description": "directory location",
                "type": "string"
            },
            "size_mb": {
                "description": "size in mb",
                "type": "integer"
            },
            "num": {
                "description": "number of log rotate",
                "type": "integer"
            },
            "level": {
                "description": "trace,debug,info,warn,error,crit,off",
                "type": "string"
            }
        },
        "required": [
            "dir_location",
            "size_mb",
            "num",
            "level"
        ]
    },
    "io_drivers": {
        "type": "object",
        "properties": {
          "dpi_input": {
              "type": "object",
              "properties": {
                  "core_bind_id": {
                      "description": "Bind this app to a core",
                      "type": "integer"
                  },
                  "watermark": {
                      "description": "ring buffer Watermark: 100",
                      "type": "integer"
                  },
                  "poll_wait_msec": {
                      "description": "polling wait in msec: 50",
                      "type": "integer"
                  },
                  "ring_cluster_id": {
                      "description": "Cluster ID (kernel clustering):5555",
                      "type": "integer"
                  },
                  "intf_names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "pcap_filters": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "qinq_vlan_push": {
                    "type": "object",
                    "properties": {
                      "tpid": {
                          "description": "Tag protocol identifier",
                          "type": "string"
                      },
                      "pcp": {
                          "description": "Priority code point",
                          "type": "integer"
                      },
                      "dei": {
                          "description": "Drop eligible indicator",
                          "type": "integer"
                      },
                      "vid": {
                          "description": "VLAN identifier ",
                          "type": "integer"
                      }
                    }
                  }
              },
              "required": [
                  "core_bind_id",
                  "watermark",
                  "poll_wait_msec",
                  "ring_cluster_id",
                  "intf_names"
              ]
          },
          "ipc_input": {
              "type": "object",
              "properties": {
                  "names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  }
              }
          },
          "st_input": {
              "type": "object",
              "properties": {
                  "name": {
                      "description": "straight through library name",
                      "type": "string"
                  }
              }
          },
          "dpi_output": {
              "type": "object",
              "properties": {
                  "core_bind_id": {
                      "description": "Bind this app to a core",
                      "type": "integer"
                  },
                  "watermark": {
                      "description": "ring buffer Watermark: 100",
                      "type": "integer"
                  },
                  "poll_wait_msec": {
                      "description": "polling wait in msec: 50",
                      "type": "integer"
                  },
                  "ring_cluster_id": {
                      "description": "Cluster ID (kernel clustering):5555",
                      "type": "integer"
                  },
                  "intf_names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "pcap_filters": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "qinq_vlan_pop": {
                    "type": "object",
                    "properties": {
                      "tpid": {
                          "description": "Tag protocol identifier",
                          "type": "string"
                      },
                      "pcp": {
                          "description": "Priority code point",
                          "type": "integer"
                      },
                      "dei": {
                          "description": "Drop eligible indicator",
                          "type": "integer"
                      },
                      "vid": {
                          "description": "VLAN identifier ",
                          "type": "integer"
                      }
                    }
                  }
              },
              "required": [
                  "core_bind_id",
                  "watermark",
                  "poll_wait_msec",
                  "ring_cluster_id",
                  "intf_names"
              ]
          },
          "ipc_output": {
              "type": "object",
              "properties": {
                  "names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  }
              }
          },
          "st_output": {
              "type": "object",
              "properties": {
                  "name": {
                      "description": "straight through library name",
                      "type": "string"
                  }
              }
          }
        }
    },
    "filters": {
        "type": "object",
        "properties": {
            "l3_blacklists": {
                "type": "array",
                "items": {
                    "type": "string"
                },
                "minItems": 0,
                "uniqueItems": true
            }
        }
    }
  },
  "required": [
    "version",
    "log",
    "io_drivers"
  ]
}

example :

{
  "version": "1.0.1",
  "log": {
    "dir_location": "/tmp/ipps",
    "size_mb": 10,
    "num": 5,
    "level": "debug"
  },
  "io_drivers": {
      "dpi_input": {
        "direction": "rx",
        "core_bind_id":1,
        "watermark": 100,
        "poll_wait_msec":10,
        "ring_cluster_id":55,
        "intf_names": ["enp0s3"]
      },
      "dpi_output": {
        "direction": "tx",
        "core_bind_id":2,
        "watermark": 1000,
        "poll_wait_msec":100,
        "ring_cluster_id":80,
        "intf_names": ["enp0s3"]
      }
  },
  "filters": {
    "l3_blacklists": [
      "192.168.56.2",
      "192.168.56.3"
    ]
  }
}

2. PPP

schema :

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Component",
  "description": "Packet Payload Processing",
  "type": "object",
  "properties": {
    "version": {
        "description": "The unique version of component",
        "type": "string"
    },
    "log": {
        "type": "object",
        "properties": {
            "dir_location": {
                "description": "directory location",
                "type": "string"
            },
            "size_mb": {
                "description": "size in mb",
                "type": "integer"
            },
            "num": {
                "description": "number of log rotate",
                "type": "integer"
            },
            "level": {
                "description": "trace,debug,info,warn,error,crit,off",
                "type": "string"
            }
        },
        "required": [
            "dir_location",
            "size_mb",
            "num",
            "level"
        ]
    },
    "io_drivers": {
        "type": "object",
        "properties": {
          "dpi_input": {
              "type": "object",
              "properties": {
                  "core_bind_id": {
                      "description": "Bind this app to a core",
                      "type": "integer"
                  },
                  "watermark": {
                      "description": "ring buffer Watermark: 100",
                      "type": "integer"
                  },
                  "poll_wait_msec": {
                      "description": "polling wait in msec: 50",
                      "type": "integer"
                  },
                  "ring_cluster_id": {
                      "description": "Cluster ID (kernel clustering):5555",
                      "type": "integer"
                  },
                  "intf_names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "pcap_filters": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "qinq_vlan_push": {
                    "type": "object",
                    "properties": {
                      "tpid": {
                          "description": "Tag protocol identifier",
                          "type": "string"
                      },
                      "pcp": {
                          "description": "Priority code point",
                          "type": "integer"
                      },
                      "dei": {
                          "description": "Drop eligible indicator",
                          "type": "integer"
                      },
                      "vid": {
                          "description": "VLAN identifier ",
                          "type": "integer"
                      }
                    }
                  }
              },
              "required": [
                  "core_bind_id",
                  "watermark",
                  "poll_wait_msec",
                  "ring_cluster_id",
                  "intf_names"
              ]
          },
          "ipc_input": {
              "type": "object",
              "properties": {
                  "names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  }
              }
          },
          "st_input": {
              "type": "object",
              "properties": {
                  "name": {
                      "description": "straight through library name",
                      "type": "string"
                  }
              }
          },
          "dpi_output": {
              "type": "object",
              "properties": {
                  "core_bind_id": {
                      "description": "Bind this app to a core",
                      "type": "integer"
                  },
                  "watermark": {
                      "description": "ring buffer Watermark: 100",
                      "type": "integer"
                  },
                  "poll_wait_msec": {
                      "description": "polling wait in msec: 50",
                      "type": "integer"
                  },
                  "ring_cluster_id": {
                      "description": "Cluster ID (kernel clustering):5555",
                      "type": "integer"
                  },
                  "intf_names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "pcap_filters": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "qinq_vlan_pop": {
                    "type": "object",
                    "properties": {
                      "tpid": {
                          "description": "Tag protocol identifier",
                          "type": "string"
                      },
                      "pcp": {
                          "description": "Priority code point",
                          "type": "integer"
                      },
                      "dei": {
                          "description": "Drop eligible indicator",
                          "type": "integer"
                      },
                      "vid": {
                          "description": "VLAN identifier ",
                          "type": "integer"
                      }
                    }
                  }
              },
              "required": [
                  "core_bind_id",
                  "watermark",
                  "poll_wait_msec",
                  "ring_cluster_id",
                  "intf_names"
              ]
          },
          "ipc_output": {
              "type": "object",
              "properties": {
                  "names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  }
              }
          },
          "st_output": {
              "type": "object",
              "properties": {
                  "name": {
                      "description": "straight through library name",
                      "type": "string"
                  }
              }
          }
        }
    },
    "plugins": {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "type": {
                    "description": "type of plugin with OR select operation",
                    "type": "string"
                },
                "services": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "description": "name of the service",
                                "type": "string"
                            },
                            "l3_ipaddr": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "l4_port": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "url_regex": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "header_regex": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "body_regex": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "minItems": 1,
                    "uniqueItems": true
                }
            },
            "required": [
                "type"
            ]
        }
    }
  },
  "required": [
    "version",
    "log",
    "io_drivers",
    "plugins"
  ]
}

example :

{
  "version": "1.0.0",
  "log": {
    "dir_location": "/tmp/ppp",
    "size_mb": 10,
    "num": 5,
    "level": "debug"
  },
  "io_drivers": {
      "dpi_input": {
        "direction": "tx",
        "core_bind_id":1,
        "watermark": 100,
        "poll_wait_msec":10,
        "ring_cluster_id":55,
        "intf_names": ["enp0s3"],
        "pcap_filters": [
          "tcp port 80",
          "udp port 80"
        ]
      },
      "dpi_output": {
        "direction": "rx",
        "core_bind_id":2,
        "watermark": 1000,
        "poll_wait_msec":100,
        "ring_cluster_id":80,
        "intf_names": ["enp0s4"],
        "qinq_vlan_push": {
          "tpid": "0x8100",
          "pcp": 4,
          "dei": 0,
          "vid": 254
        }
      }
  },
  "plugins": [
    {
      "type": "http",
      "services": [
        {
          "name": "hbo",
          "url_regex": [],
          "header_regex": [],
          "body_regex": []
        }
      ]
    },
    {
      "type": "https",
      "services": [
        {
          "name": "tls"
        }
        ]
    }
  ]
}

1. PHS

schema :

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Component",
  "description": "Packet Payload Processing",
  "type": "object",
  "properties": {
    "version": {
        "description": "The unique version of component",
        "type": "string"
    },
    "log": {
        "type": "object",
        "properties": {
            "dir_location": {
                "description": "directory location",
                "type": "string"
            },
            "size_mb": {
                "description": "size in mb",
                "type": "integer"
            },
            "num": {
                "description": "number of log rotate",
                "type": "integer"
            },
            "level": {
                "description": "trace,debug,info,warn,error,crit,off",
                "type": "string"
            }
        },
        "required": [
            "dir_location",
            "size_mb",
            "num",
            "level"
        ]
    },
    "io_drivers": {
        "type": "object",
        "properties": {
          "dpi_input": {
              "type": "object",
              "properties": {
                  "core_bind_id": {
                      "description": "Bind this app to a core",
                      "type": "integer"
                  },
                  "watermark": {
                      "description": "ring buffer Watermark: 100",
                      "type": "integer"
                  },
                  "poll_wait_msec": {
                      "description": "polling wait in msec: 50",
                      "type": "integer"
                  },
                  "ring_cluster_id": {
                      "description": "Cluster ID (kernel clustering):5555",
                      "type": "integer"
                  },
                  "intf_names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "pcap_filters": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "qinq_vlan_push": {
                    "type": "object",
                    "properties": {
                      "tpid": {
                          "description": "Tag protocol identifier",
                          "type": "string"
                      },
                      "pcp": {
                          "description": "Priority code point",
                          "type": "integer"
                      },
                      "dei": {
                          "description": "Drop eligible indicator",
                          "type": "integer"
                      },
                      "vid": {
                          "description": "VLAN identifier ",
                          "type": "integer"
                      }
                    }
                  }
              },
              "required": [
                  "core_bind_id",
                  "watermark",
                  "poll_wait_msec",
                  "ring_cluster_id",
                  "intf_names"
              ]
          },
          "ipc_input": {
              "type": "object",
              "properties": {
                  "names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  }
              }
          },
          "st_input": {
              "type": "object",
              "properties": {
                  "name": {
                      "description": "straight through library name",
                      "type": "string"
                  }
              }
          },
          "dpi_output": {
              "type": "object",
              "properties": {
                  "core_bind_id": {
                      "description": "Bind this app to a core",
                      "type": "integer"
                  },
                  "watermark": {
                      "description": "ring buffer Watermark: 100",
                      "type": "integer"
                  },
                  "poll_wait_msec": {
                      "description": "polling wait in msec: 50",
                      "type": "integer"
                  },
                  "ring_cluster_id": {
                      "description": "Cluster ID (kernel clustering):5555",
                      "type": "integer"
                  },
                  "intf_names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "pcap_filters": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  },
                  "qinq_vlan_pop": {
                    "type": "object",
                    "properties": {
                      "tpid": {
                          "description": "Tag protocol identifier",
                          "type": "string"
                      },
                      "pcp": {
                          "description": "Priority code point",
                          "type": "integer"
                      },
                      "dei": {
                          "description": "Drop eligible indicator",
                          "type": "integer"
                      },
                      "vid": {
                          "description": "VLAN identifier ",
                          "type": "integer"
                      }
                    }
                  }
              },
              "required": [
                  "core_bind_id",
                  "watermark",
                  "poll_wait_msec",
                  "ring_cluster_id",
                  "intf_names"
              ]
          },
          "ipc_output": {
              "type": "object",
              "properties": {
                  "names": {
                      "type": "array",
                      "items": {
                          "type": "string"
                      },
                      "minItems": 1,
                      "uniqueItems": true
                  }
              }
          },
          "st_output": {
              "type": "object",
              "properties": {
                  "name": {
                      "description": "straight through library name",
                      "type": "string"
                  }
              }
          }
        }
    },
    "plugins": {
        "type": "object",
        "properties": {
            "type": {
                "description": "type of plugin with OR select operation",
                "type": "string"
            },
            "services": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {

                    }
                },
                "minItems": 1,
                "uniqueItems": true
            }
        },
        "required": [
            "type"
        ]
    }
  },
  "required": [
    "version",
    "log",
    "io_drivers",
    "plugins"
  ]
}

example1 :

{
  "version": "1.0.0",
  "log": {
    "dir_location": "/tmp/phs",
    "size_mb": 10,
    "num": 5,
    "level": "debug"
  },
  "io_drivers": {
      "dpi_input": {
        "direction": "rx",
        "core_bind_id":1,
        "watermark": 100,
        "poll_wait_msec":10,
        "ring_cluster_id":55,
        "intf_names": ["enp0s4"]
      },
      "st_output": {
        "name": "libceph"
      }
  },
  "plugins":
  {
    "type": "object_store",
    "services": [
      {
        "name": "ceph_driver"
      }
    ]
  }
}

example2 :

{
  "version": "1.0.0",
  "log": {
    "dir_location": "/tmp/phs",
    "size_mb": 10,
    "num": 5,
    "level": "debug"
  },
  "io_drivers": {
      "dpi_input": {
        "direction": "rx",
        "core_bind_id":1,
        "watermark": 100,
        "poll_wait_msec":10,
        "ring_cluster_id":55,
        "intf_names": ["enp0s4"],
        "qinq_vlan_pop": {
          "tpid": "0x8100",
          "pcp": 4,
          "dei": 0,
          "vid": 254
        }
      },
      "dpi_output": {
        "direction": "tx",
        "core_bind_id":2,
        "watermark": 1000,
        "poll_wait_msec":100,
        "ring_cluster_id":80,
        "intf_names": ["enp0s4"]
      }
  },
  "plugins":
  {
    "type": "http_inj",
    "services": [{
        "name": "hbo_driver",
        "src_ipaddr_repl": "",
        "dst_ipaddr_repl": "",
        "src_port_repl": 80,
        "dst_port_repl": 765,
        "regex_payload_repl": {
          "url": [],
          "header": [],
          "body": []
       }
    }]
  }
}
Clone this wiki locally