Class: MistApi::CaptureScan

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/capture_scan.rb

Overview

Initiate a Scan Radio Packet Capture

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(ap_mac = SKIP, aps = SKIP, band = CaptureScanBandEnum::ENUM_5, bandwidth = SKIP, channel = 1, client_mac = SKIP, duration = 600, format = CaptureScanFormatEnum::PCAP, max_pkt_len = 512, num_packets = 1024, tcpdump_expression = SKIP, width = SKIP) ⇒ CaptureScan

Returns a new instance of CaptureScan.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/mist_api/models/capture_scan.rb', line 122

def initialize(ap_mac = SKIP, aps = SKIP,
               band = CaptureScanBandEnum::ENUM_5, bandwidth = SKIP,
               channel = 1, client_mac = SKIP, duration = 600,
               format = CaptureScanFormatEnum::PCAP, max_pkt_len = 512,
               num_packets = 1024, tcpdump_expression = SKIP, width = SKIP)
  @ap_mac = ap_mac unless ap_mac == SKIP
  @aps = aps unless aps == SKIP
  @band = band unless band == SKIP
  @bandwidth = bandwidth unless bandwidth == SKIP
  @channel = channel unless channel == SKIP
  @client_mac = client_mac unless client_mac == SKIP
  @duration = duration unless duration == SKIP
  @format = format unless format == SKIP
  @max_pkt_len = max_pkt_len unless max_pkt_len == SKIP
  @num_packets = num_packets unless num_packets == SKIP
  @tcpdump_expression = tcpdump_expression unless tcpdump_expression == SKIP
  @type = 'scan'
  @width = width unless width == SKIP
end

Instance Attribute Details

#ap_macString

Filter by ap_mac

Returns:

  • (String)


14
15
16
# File 'lib/mist_api/models/capture_scan.rb', line 14

def ap_mac
  @ap_mac
end

#apsHash[String, CaptureScanAps]

Dictionary key is AP mac and value is a dictionary which contains key “band”, “bandwidth”, “channel” and “tcpdump_expression”. In case keys are missed we will take parent value if parent values are not set we will use default value

Returns:



21
22
23
# File 'lib/mist_api/models/capture_scan.rb', line 21

def aps
  @aps
end

#bandCaptureScanBandEnum

Only Single value allowed, default value gets applied when user provides wrong values. enum: ‘24`, `5`, `6`

Returns:



26
27
28
# File 'lib/mist_api/models/capture_scan.rb', line 26

def band
  @band
end

#bandwidthDot11BandwidthEnum

channel width for the band.enum: ‘0`(disabled, response only), `20`, `40`, `80` (only applicable for band_5 and band_6), `160` (only for band_6)

Returns:



31
32
33
# File 'lib/mist_api/models/capture_scan.rb', line 31

def bandwidth
  @bandwidth
end

#channelInteger

Specify the channel value where scan PCAP has to be started, default value gets applied when user provides wrong values

Returns:

  • (Integer)


36
37
38
# File 'lib/mist_api/models/capture_scan.rb', line 36

def channel
  @channel
end

#client_macString

Filter by client mac

Returns:

  • (String)


40
41
42
# File 'lib/mist_api/models/capture_scan.rb', line 40

def client_mac
  @client_mac
end

#durationInteger

Duration of the capture, in seconds

Returns:

  • (Integer)


44
45
46
# File 'lib/mist_api/models/capture_scan.rb', line 44

def duration
  @duration
end

#formatCaptureScanFormatEnum

enum: ‘pcap`, `stream`



48
49
50
# File 'lib/mist_api/models/capture_scan.rb', line 48

def format
  @format
end

#max_pkt_lenInteger

enum: ‘pcap`, `stream`

Returns:

  • (Integer)


52
53
54
# File 'lib/mist_api/models/capture_scan.rb', line 52

def max_pkt_len
  @max_pkt_len
end

#num_packetsInteger

number of packets to capture, 0 for unlimited, default is 1024, maximum is 10000

Returns:

  • (Integer)


57
58
59
# File 'lib/mist_api/models/capture_scan.rb', line 57

def num_packets
  @num_packets
end

#tcpdump_expressionString

tcpdump expression, port specific if specified under ports dict, otherwise applicable across ports if specified at top level of payload. Port specific value overrides top level value when both exist.

Returns:

  • (String)


63
64
65
# File 'lib/mist_api/models/capture_scan.rb', line 63

def tcpdump_expression
  @tcpdump_expression
end

#typeString (readonly)

enum: ‘scan`

Returns:

  • (String)


67
68
69
# File 'lib/mist_api/models/capture_scan.rb', line 67

def type
  @type
end

#widthString

Specify the bandwidth value with respect to the channel.

Returns:

  • (String)


71
72
73
# File 'lib/mist_api/models/capture_scan.rb', line 71

def width
  @width
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/mist_api/models/capture_scan.rb', line 143

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ap_mac = hash.key?('ap_mac') ? hash['ap_mac'] : SKIP
  aps = CaptureScanAps.from_hash(hash['aps']) if hash['aps']

  aps = SKIP unless hash.key?('aps')
  band = hash['band'] ||= CaptureScanBandEnum::ENUM_5
  bandwidth = hash.key?('bandwidth') ? hash['bandwidth'] : SKIP
  channel = hash['channel'] ||= 1
  client_mac = hash.key?('client_mac') ? hash['client_mac'] : SKIP
  duration = hash['duration'] ||= 600
  format = hash['format'] ||= CaptureScanFormatEnum::PCAP
  max_pkt_len = hash['max_pkt_len'] ||= 512
  num_packets = hash['num_packets'] ||= 1024
  tcpdump_expression =
    hash.key?('tcpdump_expression') ? hash['tcpdump_expression'] : SKIP
  width = hash.key?('width') ? hash['width'] : SKIP

  # Create object from extracted values.
  CaptureScan.new(ap_mac,
                  aps,
                  band,
                  bandwidth,
                  channel,
                  client_mac,
                  duration,
                  format,
                  max_pkt_len,
                  num_packets,
                  tcpdump_expression,
                  width)
end

.namesObject

A mapping from model property names to API property names.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mist_api/models/capture_scan.rb', line 74

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ap_mac'] = 'ap_mac'
  @_hash['aps'] = 'aps'
  @_hash['band'] = 'band'
  @_hash['bandwidth'] = 'bandwidth'
  @_hash['channel'] = 'channel'
  @_hash['client_mac'] = 'client_mac'
  @_hash['duration'] = 'duration'
  @_hash['format'] = 'format'
  @_hash['max_pkt_len'] = 'max_pkt_len'
  @_hash['num_packets'] = 'num_packets'
  @_hash['tcpdump_expression'] = 'tcpdump_expression'
  @_hash['type'] = 'type'
  @_hash['width'] = 'width'
  @_hash
end

.nullablesObject

An array for nullable fields



111
112
113
114
115
116
117
118
119
120
# File 'lib/mist_api/models/capture_scan.rb', line 111

def self.nullables
  %w[
    ap_mac
    band
    client_mac
    duration
    max_pkt_len
    num_packets
  ]
end

.optionalsObject

An array for optional fields



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/mist_api/models/capture_scan.rb', line 93

def self.optionals
  %w[
    ap_mac
    aps
    band
    bandwidth
    channel
    client_mac
    duration
    format
    max_pkt_len
    num_packets
    tcpdump_expression
    width
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



188
189
190
191
192
193
194
195
196
# File 'lib/mist_api/models/capture_scan.rb', line 188

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_mac: #{@ap_mac.inspect}, aps: #{@aps.inspect}, band: #{@band.inspect},"\
  " bandwidth: #{@bandwidth.inspect}, channel: #{@channel.inspect}, client_mac:"\
  " #{@client_mac.inspect}, duration: #{@duration.inspect}, format: #{@format.inspect},"\
  " max_pkt_len: #{@max_pkt_len.inspect}, num_packets: #{@num_packets.inspect},"\
  " tcpdump_expression: #{@tcpdump_expression.inspect}, type: #{@type.inspect}, width:"\
  " #{@width.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



179
180
181
182
183
184
185
# File 'lib/mist_api/models/capture_scan.rb', line 179

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_mac: #{@ap_mac}, aps: #{@aps}, band: #{@band}, bandwidth: #{@bandwidth},"\
  " channel: #{@channel}, client_mac: #{@client_mac}, duration: #{@duration}, format:"\
  " #{@format}, max_pkt_len: #{@max_pkt_len}, num_packets: #{@num_packets},"\
  " tcpdump_expression: #{@tcpdump_expression}, type: #{@type}, width: #{@width}>"
end