예제 #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')
    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'])
    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
    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)
    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()
    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')
    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)
 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)
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')