summaryrefslogtreecommitdiffstats
path: root/src/plugins/srv6-as
AgeCommit message (Expand)AuthorFilesLines
2019-06-07build: add -Wall and -fno-common, fix reported issuesBenoƮt Ganne2-1/+2
2019-05-03plugins: clean up plugin descriptionsDave Wallace1-1/+1
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach1-18/+20
2018-10-23c11 safe string handling supportDave Barach1-1/+1
2018-08-27cmake: Fix plugins .h includesMohsin Kazmi1-0/+3
2018-08-25cmake: improve add_vpp_plugin macroDamjan Marion1-1/+2
2018-08-17CMake as an alternative to autotools (experimental)Damjan Marion1-0/+17
2018-07-13srv6-as: Adding support for L2 trafficFrancois Clad3-38/+243
2018-07-11srv6-as: Adding rewrite countersFrancois Clad3-21/+72
2018-03-14srv6-plugins: fixing documentationFrancois Clad1-106/+93
2018-02-01srv6-as: fixing coverity issuesFrancois Clad1-8/+32
2018-01-25srv6-as: fixing versionFrancois Clad1-1/+2
2018-01-19SRv6 static proxy pluginFrancois Clad4-0/+1239
light .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#! /usr/bin/python
'''
Copyright 2016 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''

from cmd import Cmd
import os
import subprocess
import re
import sys
try:
        import readline
except ImportError:
        readline = None

persishist = os.path.expanduser('~/.vpphistory')
persishist_size = 1000
if not persishist:
        os.mknod(persishist, stat.S_IFREG)

class Vppctl(Cmd):

        def historyWrite(self):
                if readline:
                        readline.set_history_length(persishist_size)
                        readline.write_history_file(persishist)

        def runVat(self, line):
                input_prefix = "exec "
                input_command = input_prefix + line
                line_remove = '^load_one_plugin:'
                s = '\n'
                command = ['vpp_api_test']

                if os.geteuid() != 0:
                    command = ['sudo', 'vpp_api_test']

                vpp_process = subprocess.Popen(command,
                        stderr=subprocess.PIPE,
                        stdin=subprocess.PIPE,
                        stdout=subprocess.PIPE)
                stdout_value = vpp_process.communicate(input_command)[0]

                buffer_stdout = stdout_value.splitlines()

                buffer_stdout[:]  = [b for b in buffer_stdout
                        if line_remove not in b]

                for i, num in enumerate(buffer_stdout):
                        buffer_stdout[i] = num.replace('vat# ','')

                stdout_value = s.join(buffer_stdout)
                print stdout_value

        def do_help(self, line):
                self.runVat("help")

        def default(self, line):
                self.runVat(line)

        def do_exit(self, line):
                self.historyWrite()
                raise SystemExit

        def emptyline(self):
                pass

        def do_EOF(self,line):
                self.historyWrite()
                sys.stdout.write('\n')
                raise SystemExit

        def preloop(self):
                if readline and os.path.exists(persishist):
                        readline.read_history_file(persishist)

        def postcmd(self, stop, line):
                self.historyWrite()

if __name__ == '__main__':
        command_args = sys.argv


        if not len(command_args) > 1:
                prompt = Vppctl()
                red_set = '\033[31m'
                norm_set = '\033[0m'
                if sys.stdout.isatty():
                        prompt.prompt = 'vpp# '
                        try:
                                prompt.cmdloop(red_set + "    _______    _       " + norm_set + " _   _____  ___ \n" +
                                        red_set + " __/ __/ _ \  (_)__   " + norm_set + " | | / / _ \/ _ \\\n" +
                                        red_set + " _/ _// // / / / _ \\" + norm_set + "   | |/ / ___/ ___/\n" +
                                        red_set + " /_/ /____(_)_/\___/   " + norm_set + "|___/_/  /_/   \n")
                        except KeyboardInterrupt:
                                sys.stdout.write('\n')
                else:
                        try:
                                prompt.cmdloop()
                        except KeyboardInterrupt:
                                sys.stdout.write('\n')
        else:
                del command_args[0]
                stdout_value = " ".join(command_args)
                VatAddress = Vppctl()
                VatAddress.runVat(stdout_value)