コード例 #1
0
    def post_process_table(self, field_options):
        fields_add_device_selection(self,
                                    keyword='netprofiler_device',
                                    label='NetProfiler',
                                    module='netprofiler',
                                    enabled=True)
        fields_add_time_selection(self, show_end=True, show_duration=False)

        func = Function(netprofiler_live_templates, self.options)

        TableField.create('template_id',
                          label='Template',
                          obj=self,
                          field_cls=IDChoiceField,
                          parent_keywords=['netprofiler_device'],
                          dynamic=True,
                          pre_process_func=func)

        self.add_column('template_id',
                        'Template ID',
                        datatype='string',
                        iskey=True)
        self.add_column('widget_id',
                        'Widget ID',
                        datatype='integer',
                        iskey=True)
        self.add_column('title', 'Title', datatype='string')
        self.add_column('widget_type', 'Type', datatype='string')
        self.add_column('visualization', 'Visualization', datatype='string')
        self.add_column('datasource', 'Data Source', datatype='string')
コード例 #2
0
    def post_process_table(self, field_options):
        resolution = field_options['resolution']
        if resolution != 'auto':
            if isinstance(resolution, int):
                res = resolution
            else:
                res = int(timedelta_total_seconds(parse_timedelta(resolution)))
            resolution = Report.RESOLUTION_MAP[res]
            field_options['resolution'] = resolution

        fields_add_device_selection(self, keyword='netprofiler_device',
                                    label='NetProfiler', module='netprofiler',
                                    enabled=True)

        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%d min" % duration

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])

        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'],
                              special_values=['auto'])
        self.fields_add_filterexpr()
コード例 #3
0
    def post_process_table(self, field_options):
        resolution = field_options['resolution']
        if resolution != 'auto':
            if isinstance(resolution, int):
                res = resolution
            else:
                res = int(timedelta_total_seconds(parse_timedelta(resolution)))
            resolution = Report.RESOLUTION_MAP[res]
            field_options['resolution'] = resolution

        fields_add_device_selection(self, keyword='netprofiler_device',
                                    label='NetProfiler', module='netprofiler',
                                    enabled=True)

        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%d min" % duration

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])

        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'],
                              special_values=['auto'])
        self.fields_add_filterexpr()
コード例 #4
0
    def post_process_table(self, field_options):
        # Add criteria fields that are required by this table
        #

        # Add a time selection field
        fields_add_time_selection(self,
                                  initial_duration=field_options['duration'],
                                  durations=field_options['durations'],
                                  special_values=['All'])
コード例 #5
0
    def post_process_table(self, field_options):
        fields_add_device_selection(self, keyword='netprofiler_device',
                                    label='NetProfiler', module='netprofiler',
                                    enabled=True)

        duration = field_options['duration']

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
コード例 #6
0
ファイル: scc.py プロジェクト: carriercomm/steelscript-scc
    def post_process_table(self, field_options):
        super(BaseSCCStatsTable, self).post_process_table(field_options)

        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%d min" % duration

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
コード例 #7
0
    def post_process_table(self, field_options):
        fields_add_device_selection(self, keyword='netprofiler_device',
                                    label='NetProfiler', module='netprofiler',
                                    enabled=True)

        duration = field_options['duration']

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
コード例 #8
0
    def post_process_table(self, field_options):
        super(BaseSCCStatsTable, self).post_process_table(field_options)

        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%d min" % duration

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
コード例 #9
0
    def post_process_table(self, field_options):
        # Add a time selection field
        fields_add_time_selection(self, show_end=False,
                                  initial_duration=field_options['duration'],
                                  durations=field_options['durations'])

        # Add time resolution selection
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])

        # Add end date field
        self.fields_add_end_date()
コード例 #10
0
    def post_process_table(self, field_options):
        fields_add_device_selection(self,
                                    keyword='netshark_device_src',
                                    label='NetShark Source',
                                    module='netshark',
                                    enabled=True)
        fields_add_device_selection(self,
                                    keyword='netshark_device_dst',
                                    label='NetShark Dest',
                                    module='netshark',
                                    enabled=True)

        fields_add_device_selection(self,
                                    keyword='netshark_device_upload',
                                    label='NetShark MSA',
                                    module='netshark',
                                    enabled=True)
        TableField.create(
            keyword='netshark_source_name_src',
            label='Source Capture Job',
            obj=self,
            field_cls=forms.ChoiceField,
            field_kwargs={'widget_attrs': {
                'class': 'form-control'
            }},
            parent_keywords=['netshark_device_src'],
            dynamic=True,
            pre_process_func=Function(netshark_source_choices,
                                      {'field': 'netshark_device_src'}))
        TableField.create(
            keyword='netshark_source_name_dst',
            label='Dest Capture Job',
            obj=self,
            field_cls=forms.ChoiceField,
            field_kwargs={'widget_attrs': {
                'class': 'form-control'
            }},
            parent_keywords=['netshark_device_dst'],
            dynamic=True,
            pre_process_func=Function(netshark_source_choices,
                                      {'field': 'netshark_device_dst'}))

        fields_add_time_selection(self,
                                  show_start=True,
                                  initial_start_time='now-1m',
                                  show_end=True,
                                  show_duration=False)

        fields_add_filterexpr(obj=self)
def fields_add_business_hour_fields(obj,
                                    initial_biz_hours_start='8:00am',
                                    initial_biz_hours_end='5:00pm',
                                    initial_biz_hours_tzname='US/Eastern',
                                    initial_biz_hours_weekends=False,
                                    **kwargs):

    kwargs['initial_duration'] = kwargs.get('initial_duration', '1w')
    fields_add_time_selection(obj, show_start=True, **kwargs)

    time_choices = {'choices': zip(TIMES, TIMES)}
    business_hours_start = TableField(keyword='business_hours_start',
                                      label='Start Business',
                                      initial=initial_biz_hours_start,
                                      field_cls=forms.ChoiceField,
                                      field_kwargs=time_choices,
                                      required=True)
    business_hours_start.save()
    obj.fields.add(business_hours_start)

    business_hours_end = TableField(keyword='business_hours_end',
                                    label='End Business',
                                    initial=initial_biz_hours_end,
                                    field_cls=forms.ChoiceField,
                                    field_kwargs=time_choices,
                                    required=True)
    business_hours_end.save()
    obj.fields.add(business_hours_end)

    tz_choices = {'choices': zip(pytz.common_timezones,
                                 pytz.common_timezones)}
    business_hours_tzname = TableField(keyword='business_hours_tzname',
                                       label='Business Timezone',
                                       initial=initial_biz_hours_tzname,
                                       field_cls=forms.ChoiceField,
                                       field_kwargs=tz_choices,
                                       required=True)
    business_hours_tzname.save()
    obj.fields.add(business_hours_tzname)

    business_hours_weekends = TableField(keyword='business_hours_weekends',
                                         field_cls=forms.BooleanField,
                                         label='Business includes weekends',
                                         initial=initial_biz_hours_weekends,
                                         required=False)
    business_hours_weekends.save()
    obj.fields.add(business_hours_weekends)
コード例 #12
0
    def post_process_table(self, field_options):
        #
        # Add criteria fields that are required by this table
        #
        TableField.create(keyword='entire_pcap', obj=self,
                          field_cls=forms.BooleanField,
                          label='Entire PCAP',
                          initial=True,
                          required=False)

        fields_add_time_selection(self, show_start=True, show_end=True,
                                  show_duration=False)
        fields_add_resolution(obj=self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])
        fields_add_pcapfile(
            obj=self, astextfield=field_options['pcapfile_astextfield'])
        fields_add_filterexpr(obj=self)
コード例 #13
0
    def post_process_table(self, field_options):
        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "{}m".format(duration)

        fields_add_device_selection(self,
                                    keyword='netshark_device',
                                    label='NetShark',
                                    module='netshark',
                                    enabled=True)

        func = Function(netshark_msa_file_choices, self.options)
        TableField.create(
            keyword='netshark_source_name',
            label='Source',
            obj=self,
            field_cls=IDChoiceField,
            field_kwargs={'widget_attrs': {
                'class': 'form-control'
            }},
            parent_keywords=['netshark_device'],
            dynamic=True,
            pre_process_func=func)

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])

        if self.options.include_filter:
            fields_add_filterexpr(self)

        if self.options.include_bpf_filter:
            fields_add_bpf_filterexpr(self)

        if self.options.show_entire_msa:
            TableField.create(keyword='entire_msa',
                              obj=self,
                              field_cls=forms.BooleanField,
                              label='Entire MSA (ignore start/end times)',
                              initial=True,
                              required=False)
コード例 #14
0
    def post_process_table(self, field_options):
        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%dm" % duration

        fields_add_device_selection(self,
                                    keyword='netshark_device',
                                    label='NetShark',
                                    module='netshark',
                                    enabled=True)

        func = Function(netshark_source_name_choices, self.options)
        TableField.create(
            keyword='netshark_source_name',
            label='Source',
            obj=self,
            field_cls=IDChoiceField,
            field_kwargs={'widget_attrs': {
                'class': 'form-control'
            }},
            parent_keywords=['netshark_device'],
            dynamic=True,
            pre_process_func=func)

        if self.options.include_persistent:
            TableField.create(keyword='netshark_persistent',
                              label='Persistent View',
                              obj=self,
                              field_cls=forms.BooleanField,
                              initial=False)

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])

        if self.options.include_filter:
            fields_add_filterexpr(self)

        if self.options.include_bpf_filter:
            fields_add_bpf_filterexpr(self)
コード例 #15
0
 def post_process_table(self, field_options):
     fields_add_device_selection(self, keyword='netshark_device',
                                 label='NetShark', module='netshark',
                                 enabled=True)
     fields_add_time_selection(self, show_start=True,
                               initial_start_time='now-1m',
                               show_end=True,
                               show_duration=False)
     fields_add_resolution(self,
                           initial=field_options['resolution'],
                           resolutions=field_options['resolutions'])
     func = Function(netshark_source_name_choices, self.options)
     TableField.create(keyword='netshark_source_name', label='Source',
                       obj=self,
                       field_cls=forms.ChoiceField,
                       parent_keywords=['netshark_device'],
                       dynamic=True,
                       pre_process_func=func)
     fields_add_filterexpr(obj=self)
     self.add_column('filename', datatype='string')
コード例 #16
0
    def post_process_table(self, field_options):
        fields_add_device_selection(self, keyword='netshark_device_src',
                                    label='NetShark Source', module='netshark',
                                    enabled=True)
        fields_add_device_selection(self, keyword='netshark_device_dst',
                                    label='NetShark Dest', module='netshark',
                                    enabled=True)

        fields_add_device_selection(self, keyword='netshark_device_upload',
                                    label='NetShark MSA', module='netshark',
                                    enabled=True)
        TableField.create(
            keyword='netshark_source_name_src',
            label='Source Capture Job',
            obj=self,
            field_cls=forms.ChoiceField,
            field_kwargs={'widget_attrs': {'class': 'form-control'}},
            parent_keywords=['netshark_device_src'],
            dynamic=True,
            pre_process_func=Function(netshark_source_choices,
                                      {'field': 'netshark_device_src'})
        )
        TableField.create(
            keyword='netshark_source_name_dst',
            label='Dest Capture Job',
            obj=self,
            field_cls=forms.ChoiceField,
            field_kwargs={'widget_attrs': {'class': 'form-control'}},
            parent_keywords=['netshark_device_dst'],
            dynamic=True,
            pre_process_func=Function(netshark_source_choices,
                                      {'field': 'netshark_device_dst'})
        )

        fields_add_time_selection(self, show_start=True,
                                  initial_start_time='now-1m',
                                  show_end=True,
                                  show_duration=False)

        fields_add_filterexpr(obj=self)
コード例 #17
0
    def post_process_table(self, field_options):
        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "{}m".format(duration)

        fields_add_device_selection(self, keyword='netshark_device',
                                    label='NetShark', module='netshark',
                                    enabled=True)

        func = Function(netshark_msa_file_choices,
                        self.options)
        TableField.create(keyword='netshark_source_name', label='Source',
                          obj=self,
                          field_cls=IDChoiceField,
                          field_kwargs={
                              'widget_attrs': {'class': 'form-control'}
                          },
                          parent_keywords=['netshark_device'],
                          dynamic=True,
                          pre_process_func=func)

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])

        if self.options.include_filter:
            fields_add_filterexpr(self)

        if self.options.include_bpf_filter:
            fields_add_bpf_filterexpr(self)

        if self.options.show_entire_msa:
            TableField.create(keyword='entire_msa', obj=self,
                              field_cls=forms.BooleanField,
                              label='Entire MSA (ignore start/end times)',
                              initial=True,
                              required=False)
コード例 #18
0
    def post_process_table(self, field_options):
        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%dm" % duration

        fields_add_device_selection(self, keyword='netshark_device',
                                    label='NetShark', module='netshark',
                                    enabled=True)

        func = Function(netshark_source_name_choices,
                        self.options)
        TableField.create(
            keyword='netshark_source_name', label='Source',
            obj=self,
            field_cls=IDChoiceField,
            field_kwargs={'widget_attrs': {'class': 'form-control'}},
            parent_keywords=['netshark_device'],
            dynamic=True,
            pre_process_func=func
        )

        if self.options.include_persistent:
            TableField.create(keyword='netshark_persistent',
                              label='Persistent View', obj=self,
                              field_cls=forms.BooleanField,
                              initial=False)

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])

        if self.options.include_filter:
            fields_add_filterexpr(self)

        if self.options.include_bpf_filter:
            fields_add_bpf_filterexpr(self)
コード例 #19
0
    def post_process_table(self, field_options):
        # Add a time selection field

        fields_add_device_selection(self, keyword='appresponse_device',
                                    label='AppResponse', module='appresponse',
                                    enabled=True)

        if self.options.source == 'packets':
            func = Function(appresponse_source_choices, self.options)
            fields_add_source_choices(self, func)

            if self.options.show_entire_pcap:
                fields_add_entire_pcap(self)

        if self.options.include_filter:
            fields_add_filterexpr(self)

        fields_add_granularity(self, initial=field_options['granularity'],
                               source=self.options.source)

        fields_add_time_selection(self, show_end=True,
                                  initial_duration=field_options['duration'])
コード例 #20
0
    def post_process_table(self, field_options):
        # Add a time selection field

        fields_add_device_selection(self,
                                    keyword='appresponse_device',
                                    label='AppResponse',
                                    module='appresponse',
                                    enabled=True)

        if self.options.source == 'packets':
            func = Function(appresponse_source_choices, self.options)

            TableField.create(
                keyword='appresponse_source',
                label='Source',
                obj=self,
                field_cls=IDChoiceField,
                field_kwargs={'widget_attrs': {
                    'class': 'form-control'
                }},
                parent_keywords=['appresponse_device'],
                dynamic=True,
                pre_process_func=func)

            if self.options.show_entire_pcap:
                TableField.create(keyword='entire_pcap',
                                  obj=self,
                                  field_cls=forms.BooleanField,
                                  label='Entire PCAP',
                                  initial=True,
                                  required=False)

        fields_add_granularity(self,
                               initial=field_options['granularity'],
                               source=self.options.source)

        fields_add_time_selection(self,
                                  show_end=True,
                                  initial_duration=field_options['duration'])
コード例 #21
0
    def post_process_table(self, field_options):
        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%dm" % duration

        fields_add_device_selection(self, keyword='netshark_device',
                                    label='NetShark', module='netshark',
                                    enabled=True)

        TableField.create(keyword='netshark_source_name', label='Source',
                          obj=self,
                          field_cls=forms.ChoiceField,
                          parent_keywords=['netshark_device'],
                          dynamic=True,
                          pre_process_func=Function(netshark_source_name_choices))

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])
        self.fields_add_filterexpr()
コード例 #22
0
    def post_process_table(self, field_options):
        fields_add_device_selection(self, keyword='netprofiler_device',
                                    label='NetProfiler', module='netprofiler',
                                    enabled=True)
        fields_add_time_selection(self, show_end=True, show_duration=False)

        func = Function(netprofiler_live_templates, self.options)

        TableField.create('template_id', label='Template',
                          obj=self,
                          field_cls=IDChoiceField,
                          parent_keywords=['netprofiler_device'],
                          dynamic=True,
                          pre_process_func=func)

        self.add_column('template_id', 'Template ID', datatype='string',
                        iskey=True)
        self.add_column('widget_id', 'Widget ID', datatype='integer',
                        iskey=True)
        self.add_column('title', 'Title', datatype='string')
        self.add_column('widget_type', 'Type', datatype='string')
        self.add_column('visualization', 'Visualization', datatype='string')
        self.add_column('datasource', 'Data Source', datatype='string')
コード例 #23
0
    def post_process_table(self, field_options):
        #
        # Add criteria fields that are required by this table
        #
        if self.options.show_entire_pcap:
            TableField.create(keyword='entire_pcap',
                              obj=self,
                              field_cls=forms.BooleanField,
                              label='Entire PCAP',
                              initial=True,
                              required=False)

        fields_add_time_selection(self,
                                  show_start=True,
                                  show_end=True,
                                  show_duration=False)
        fields_add_resolution(obj=self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])

        if self.options.show_pcap_mgr:
            fields_add_pcapmgr_selection(obj=self)
        fields_add_filterexpr(obj=self)
コード例 #24
0
 def post_process_table(self, field_options):
     fields_add_device_selection(self,
                                 keyword='netshark_device',
                                 label='NetShark',
                                 module='netshark',
                                 enabled=True)
     fields_add_time_selection(self,
                               show_start=True,
                               initial_start_time='now-1m',
                               show_end=True,
                               show_duration=False)
     fields_add_resolution(self,
                           initial=field_options['resolution'],
                           resolutions=field_options['resolutions'])
     func = Function(netshark_source_name_choices, self.options)
     TableField.create(keyword='netshark_source_name',
                       label='Source',
                       obj=self,
                       field_cls=forms.ChoiceField,
                       parent_keywords=['netshark_device'],
                       dynamic=True,
                       pre_process_func=func)
     fields_add_filterexpr(obj=self)
     self.add_column('filename', datatype='string')
コード例 #25
0
 def post_process_table(self, field_options):
     self.add_column('time', 'Time', iskey=True, datatype='time')
     self.add_column('value', 'Value')
     fields_add_time_selection(self)
     fields_add_resolution(self)
コード例 #26
0
 def post_process_table(self, field_options):
     self.add_column('time', 'Time', iskey=True, datatype='time')
     self.add_column('value', 'Value')
     fields_add_time_selection(self)
     fields_add_resolution(self)
コード例 #27
0
from steelscript.appfwk.apps.report.models import Report
import steelscript.appfwk.apps.report.modules.raw as raw
from steelscript.appfwk.apps.datasource.forms import fields_add_time_selection
from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable

report = Report.create(title='Criteria Time Selection')
report.add_section()

a = CriteriaTable.create('test-criteria-timeselection')
fields_add_time_selection(a, initial_duration='1 day')

report.add_widget(raw.TableWidget, a, 'Table')