-
Notifications
You must be signed in to change notification settings - Fork 11
Security fix from n1 to main #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lstruman
wants to merge
433
commits into
main
Choose a base branch
from
security-fix-from-n1-to-main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
433 commits
Select commit
Hold shift + click to select a range
e9d9493
Merge pull request #195 from rdkcentral/james-dev
lstruman 3a24698
Add debug loggings for 403 error analysis
lstruman 820b678
Add debug loggings for 403 error analysis
lstruman 98e9e7d
Add debug loggings for 403 error analysis
lstruman 4e9fd6b
Merge pull request #196 from rdkcentral/cherrypick-log403
lstruman bdd12bb
return 404 for NONE-REBOOT without subdocs
lstruman 616e068
Merge pull request #197 from rdkcentral/james-dev
lstruman ec1f5b7
return 404 for NONE-REBOOT without subdocs
lstruman 39ac9d0
Merge pull request #198 from rdkcentral/cherrypick-none-reboot-404
lstruman d165d6d
Reduce unnecessary upstream calls when no meta headers change
lstruman 900eb75
Merge pull request #199 from rdkcentral/james-dev
lstruman ad941aa
add a flag to control the enabling of sarama logger
lstruman d4fba5e
Merge pull request #200 from rdkcentral/james-dev
lstruman 016b28b
Merge pull request #201 from rdkcentral/develop
lstruman 0c4814c
change frequently used headers from literals to consts
lstruman a879e3b
Merge pull request #202 from rdkcentral/james-dev
lstruman 4232990
ix a bug that status=0 was logged when the last subdoc was deleted
lstruman 34c986f
Merge pull request #203 from rdkcentral/james-dev
lstruman b766d8c
log kafka async producer errors
lstruman 71610e8
Merge pull request #204 from rdkcentral/james-dev
lstruman da5879c
ix a bug that status=0 was logged when the last subdoc was deleted
lstruman 217d7cf
log kafka async producer errors
lstruman 07a4bb1
Merge pull request #205 from rdkcentral/cherrypick-async-producer-log…
lstruman 7ff2a1f
handle 202 returned by webpa poke
lstruman 8a6c59d
Merge pull request #206 from rdkcentral/james-dev
lstruman 261b2e5
update states only when the version in the notification matches the v…
lstruman 987a346
Merge pull request #207 from rdkcentral/james-dev
lstruman 9108c39
change the poke 204 condition to all deployed
lstruman 77eeb94
Merge pull request #208 from rdkcentral/james-dev
lstruman a0a7c01
fix a bug that version matched subdocs are not backfilled from upstream
lstruman 0735172
Merge pull request #209 from rdkcentral/james-dev
lstruman 5f819c0
update states only when the version in the notification matches the v…
lstruman b83d57a
change the poke 204 condition to all deployed
lstruman 872d747
fix a bug that version matched subdocs are not backfilled from upstream
lstruman a13d53a
Merge pull request #210 from rdkcentral/cherrypick-2024-oct-18
lstruman 132e15a
change frequently used headers from literals to consts
lstruman a1dc8d2
Merge pull request #211 from rdkcentral/cherrypick-2024-oct-18
lstruman 04a2dc4
check nil conditions for kafka async producer errors
lstruman fe85cfa
Merge pull request #212 from rdkcentral/james-dev
lstruman 63e902b
check the nil condition for kafka async producer successes
lstruman 1da11e5
Merge pull request #213 from rdkcentral/james-dev
lstruman bef8fc7
check nil conditions for kafka async producer errors
lstruman 9bd2c8f
check the nil condition for kafka async producer successes
lstruman d407369
Merge pull request #214 from rdkcentral/cherrypick-async-producer-res…
lstruman b254873
add bitmap supprot for subdoc webui
lstruman 9353e9b
Merge pull request #215 from rdkcentral/james-dev
lstruman 1ae6e58
fix a bug that 500 was returned when the reference doc was not found
lstruman cdda9af
Merge pull request #216 from rdkcentral/james-dev
lstruman cbca2d6
handle 202 returned by webpa poke
lstruman 7c09ed9
Merge pull request #217 from rdkcentral/cherrypick-poke-202
lstruman bf83753
change the updated_time as usual even if state=1
lstruman 120e187
Merge pull request #218 from rdkcentral/james-dev
lstruman 3845b7d
return 409 if the root_document is locked
lstruman a9c48c6
Merge pull request #219 from rdkcentral/james-dev
lstruman a01d3bb
change the updated_time as usual even if state=1
lstruman 459d72d
Merge pull request #220 from rdkcentral/cherrypick-state1-upddate
lstruman c75288f
add a control flag for root_document locking
lstruman f8f5899
Merge pull request #221 from rdkcentral/james-dev
lstruman f8a86a2
fix a bug that 500 was returned when the reference doc was not found
lstruman 6cd321e
Merge pull request #222 from rdkcentral/cherrypick-noreference-handling
lstruman 93a333f
return 409 if the root_document is locked
lstruman 6297aa0
add a control flag for root_document locking
lstruman a1de683
Merge pull request #223 from rdkcentral/cherrypick-lock-root-document
lstruman b5b428c
add bitmap supprot for subdoc webui
lstruman ce84f32
Merge pull request #224 from rdkcentral/cherrypick-webui-bitmap
lstruman 33f6466
add an option to read profiles from upstream
lstruman eb403b2
Merge pull request #225 from rdkcentral/james-dev
lstruman b289cbe
fix a bug that error_code and error_details were not cleanup during s…
lstruman 816628b
Merge pull request #226 from rdkcentral/james-dev
lstruman e037db0
fix a bug that error_code and error_details were not cleanup during s…
lstruman bf3d308
Merge pull request #227 from rdkcentral/cherrypick-errorcodes-fix
lstruman e00d70e
enforce strict format in device GET route
lstruman 86c2081
Merge pull request #228 from rdkcentral/james-dev
lstruman f4b217e
add token trust validation
lstruman 903611d
Merge pull request #229 from rdkcentral/james-dev
lstruman 07e4e16
cherrypick strict format check and resolve conflicts
lstruman f0daec5
Merge pull request #230 from rdkcentral/cherrypick-strict-format-check
lstruman ddbbb08
accept non bitmap subdocs when the validator is enabled during device…
lstruman f2d3450
Merge pull request #231 from rdkcentral/james-dev
lstruman 7ccaf8c
cherrypick non bitmap validation and resolve conflicts
lstruman 3aea3ad
Merge pull request #232 from rdkcentral/cherrypick-strict-format-chec…
lstruman 9a1c893
cherrypick the feature to validate token trust value and resolve conf…
lstruman d6ff5a9
Merge pull request #233 from rdkcentral/cherrypick-token-trust-validaton
lstruman 969249e
log details for token errors
lstruman d3a7823
Merge pull request #234 from rdkcentral/james-dev
lstruman 8200e8d
log details for token errors
lstruman 9d9ca15
Merge pull request #235 from rdkcentral/cherrypick-log-token-err
lstruman 884fff2
cherrypick upstream profiles and merge conflicts
lstruman f3032de
Merge pull request #236 from rdkcentral/cherrypick-upstream-profiles
lstruman eb7872f
Add support for poke root and telemetry together
lstruman 22dafa8
Merge pull request #237 from rdkcentral/james-dev
lstruman 7e32cdd
set updated_time in the case of state correction
lstruman 1801e4e
Merge pull request #238 from rdkcentral/james-dev
lstruman bb27227
set updated_time in the case of state correction
lstruman c4bb805
Merge pull request #239 from rdkcentral/cherrypick-bugfix-updated_time
lstruman 6b6de0b
propagate headers for tracing
lstruman 022e3ce
Merge pull request #240 from rdkcentral/james-dev
lstruman 9b69306
remove otel span codes
lstruman 5fccaa9
Merge pull request #241 from rdkcentral/james-dev
lstruman e454080
restore otel codes
lstruman 24a94ce
Merge pull request #242 from rdkcentral/james-dev
lstruman 751143d
add back a missed file
lstruman a0b66d0
Merge pull request #243 from rdkcentral/james-dev
lstruman 6bea1ad
handle tracing propagation
lstruman 127cee1
add back calling otelshutdown
lstruman 13a9c62
roll back go.mod to use 1.21
lstruman 2d72e45
Merge pull request #244 from rdkcentral/james-dev
lstruman a5984fb
change the poke keyword from primary to root
lstruman 29afd6e
Merge pull request #245 from rdkcentral/james-dev
lstruman bf96308
Set Otel Span attribute for x-cl-expt
rvsubbu 656f401
Merge pull request #246 from rvsubbu/rv_dev
lstruman 67aa9fb
merge n-1 and resolve conflicts
lstruman a773ed3
Merge pull request #248 from rdkcentral/james-dev
lstruman 5c38f8c
Merge pull request #249 from rdkcentral/develop
lstruman 228e911
Migrate/adapt/rewrite tracing
rvsubbu 0e5f43a
Remove all homegrown algorithm code as it is never going to be used
rvsubbu 2bff04a
Merge pull request #250 from rvsubbu/rv_dev
lstruman 04acd43
Merge pull request #251 from rdkcentral/develop
lstruman 4905893
case diffs in env var e.g. use site_color instead of SITE_COLOR
rvsubbu 1beee4a
Merge pull request #252 from rvsubbu/rv_dev
lstruman a50cf7f
Typo
rvsubbu 777b1d3
Merge pull request #253 from rvsubbu/rv_dev
lstruman 776d7e9
Merge pull request #254 from rdkcentral/develop
lstruman dbdee27
Standardize logs - use "message" instead of "msg"
rvsubbu d4b65a0
Merge pull request #255 from rvsubbu/rv_dev
lstruman b6bdcf2
fix a bug that new spanid are not included in the traceparent of outg…
lstruman 9d61ad7
Merge pull request #256 from rdkcentral/james-dev
lstruman ba3211f
Merge pull request #257 from rdkcentral/develop
lstruman e9e969a
Make external url templates configurable
lstruman 0e84777
Merge pull request #258 from rdkcentral/james-dev
lstruman 51270b4
Merge pull request #259 from rdkcentral/develop
lstruman 51f619e
tracing codes rearranged
lstruman 13e8d5c
remove unused func args
lstruman 087035a
clean up unused contexts
lstruman 719198d
clean up used contexts cont.
lstruman 3bf15ca
small changes in tracing context functions
lstruman 85b9308
small changes based on review
lstruman 6a819ca
Merge pull request #260 from rdkcentral/james-dev
lstruman d99ae6d
Refactoring missed the tag settig part
rvsubbu 4e1ff75
Merge pull request #261 from rvsubbu/rv_dev
lstruman 4fcd3a3
Merge pull request #262 from rdkcentral/develop
lstruman 514667e
filter webconfig output by bitmap
lstruman 75459c1
Merge pull request #263 from rdkcentral/james-dev
lstruman fb559f4
add a log field and some cleanup
lstruman 2980e2f
Merge pull request #264 from rdkcentral/james-dev
lstruman 2e703c5
Merge pull request #265 from rdkcentral/develop
lstruman c77a999
propagate request response headers
lstruman e5d8b76
Merge pull request #266 from rdkcentral/james-dev
lstruman abc0717
handle mqtt poke 403 errors
lstruman e27b79e
Merge pull request #267 from rdkcentral/james-dev
lstruman ad8ff9a
Handle header x-cl-canary for moracide
lstruman 796096a
Merge pull request #268 from rdkcentral/james-dev
lstruman cea2264
Merge pull request #269 from rdkcentral/develop
lstruman a5e599d
Fix a bug that 200 empty profiles were return when both xconf and ups…
lstruman 7aec3ba
Merge pull request #270 from rdkcentral/james-dev
lstruman 0652e25
Merge branch 'develop' of github.com:rdkcentral/webconfig into develop
rvsubbu 762bae9
Add version info to otel instrumentation
rvsubbu ea14fd0
Add SHA to version info
rvsubbu fa97206
Merge pull request #271 from rvsubbu/rv_zzz
lstruman 4e59b16
version info to include app name
rvsubbu 890a77b
Merge pull request #272 from rvsubbu/rv_zzz
lstruman d09d5b6
Cherrypick of adding appname to version
rvsubbu e9d2a06
Merge pull request #273 from rvsubbu/developn-1
lstruman 9a2e876
support subdocs without bitmaps
lstruman de90cdb
skip logging pending notifications
lstruman f706a41
Merge pull request #274 from rdkcentral/james-dev
lstruman a1a2e58
Parse the bitmap of the channelplan subdoc
lstruman d9d30d5
Merge pull request #277 from rdkcentral/james-dev
lstruman 4f573d5
skip logging pending notifications
lstruman f818474
Merge pull request #278 from rdkcentral/cherrypick-telemetry-log
lstruman d6808b9
Parse the bitmap of the channelplan subdoc
lstruman 24d47f0
Merge pull request #279 from rdkcentral/cherry-pick-bitmap-channelplan
lstruman db04afe
fix a bug that 200 was returned when no subdoc was sent
lstruman 4cde486
Merge pull request #280 from rdkcentral/james-dev
lstruman 39cbd57
cherrypick changes to support no-bitmap subdocs
lstruman 21ee580
Merge pull request #281 from rdkcentral/cherrypick-subdocs-without-bi…
lstruman 1bc05f8
fix a bug that 304 was returned when GET was without x-supported-docs…
lstruman c97c772
Merge pull request #284 from rdkcentral/james-dev
lstruman 359426a
merge developn-1 branch and resolve conflicts
lstruman d505eb9
Merge pull request #285 from rdkcentral/james-dev
lstruman 8789682
fix a bug that 304 was returned when GET was without x-supported-docs…
lstruman 3dc63a0
Merge pull request #286 from rdkcentral/cherrypick-no-bitmap-header
lstruman b824a6a
update the dbinit.cql script for new columns
lstruman eb9f5f1
Merge pull request #287 from rdkcentral/james-dev
lstruman dc6909f
change the log level for db not found
lstruman 81781b5
Merge pull request #289 from rdkcentral/james-dev
lstruman 494e6a6
Just a more detailed error message
rvsubbu 00f1e91
Standarize "Request started" and "Request finished" messages
rvsubbu 1e317bc
Handle invalid cpemac value of 000000000000
rvsubbu adab517
Merge pull request #290 from rvsubbu/rv_dev
lstruman 4a8161b
Fix a bug that payload was not updated after upstream if the new vers…
lstruman fe097b4
Merge pull request #292 from rdkcentral/james-dev
lstruman eca2d62
Fix a bug that payload was not updated after upstream if the new vers…
lstruman ed64ce2
Merge pull request #293 from rdkcentral/cherrypick-schema-update-bug
lstruman 5592a8f
Just a more detailed error message
rvsubbu ef1c102
Standarize "Request started" and "Request finished" messages
rvsubbu 0acce1e
Handle invalid cpemac value of 000000000000
rvsubbu 9cb8c7d
Merge pull request #294 from rdkcentral/cherrypick-log-change-nov25
lstruman 0a31007
fix a bug that bitmap filtering was not applied for NONE/NONE-REBOOT …
lstruman 47915d8
Merge pull request #295 from rdkcentral/james-dev
lstruman 103f782
modify the use patterns of rand package
lstruman 76e67b6
Merge pull request #296 from rdkcentral/james-dev
lstruman 30f979a
fix a bug that bitmap filtering was not applied for NONE/NONE-REBOOT …
lstruman f2df8b1
modify the use patterns of rand package
lstruman 58e31f4
Merge pull request #297 from rdkcentral/cherrypick-bugfix-bitmap-filt…
lstruman befc8ca
GET supplementary can return precook telemetry data
lstruman 9116ada
Merge pull request #298 from rdkcentral/james-dev
lstruman d880dad
Add support for kafka secure connection
lstruman ff48ad3
Merge pull request #299 from rdkcentral/james-dev
lstruman ed01365
Add support to allow skipping table creation during test
lstruman 67cc750
Merge pull request #300 from rdkcentral/james-dev
lstruman 742d2e2
Rollback changes for sqlite. Skipping table creation during tests is …
lstruman 1ae9f26
Merge pull request #301 from rdkcentral/james-dev
lstruman 1e2d01c
Update the sample Cassandra configuration to use a non-SSL connection
lstruman 05ee124
Merge pull request #302 from rdkcentral/james-dev
lstruman 72dee33
Revert "Update the sample Cassandra configuration to use a non-SSL co…
lstruman 6a3ff5c
Merge pull request #303 from rdkcentral/james-dev
lstruman bc8cf47
Add cassandra config for tls as we upgraded the dependency libs in go…
lstruman 25846da
Merge pull request #304 from rdkcentral/james-dev
lstruman 524862b
Add tls configs to work with a targeted cassandra env
lstruman f532193
Merge pull request #305 from rdkcentral/james-dev
lstruman 0892bd0
Fix a bug that wronge hocon paths wwere used to read kafka tls configs
lstruman 86e43a1
Merge pull request #306 from rdkcentral/james-dev
lstruman 5a41e78
Add back cassandra ciphersuite configs removed by mistake
lstruman c5796d3
Merge pull request #307 from rdkcentral/james-dev
lstruman b567031
Merge pull request #308 from rdkcentral/develop
lstruman 2cf1f23
fix a bug that error_code and error_details columns were not reset wh…
lstruman 6668e7f
Merge pull request #311 from rdkcentral/cherrypick-bugfix-state-reset
lstruman 826c144
handle failed sqlite related tests during root_document schema change
lstruman 163fe4a
Merge pull request #313 from rdkcentral/cherrypick-bugfix-state-reset
lstruman 261241b
Store new headers X-System-Product-Class and X-System-Type into root_…
lstruman cdb6530
Add missing code for customer_type and product_class support
lstruman 832fc2e
Merge pull request #316 from rdkcentral/cherrypick-header-x-system-type
lstruman c8f8113
rename column name from customer_type to account_type
lstruman a33ea4f
Merge pull request #318 from rdkcentral/cherrypick-support-account-type
lstruman 43ac181
update dependencies based code scan advice
lstruman 805c5a1
update dependencies based code scan advice
lstruman 1c91abc
Merge pull request #321 from rdkcentral/cherrypick-update-dependencies
lstruman e5ed638
add a codeql.yml file
lstruman 3083892
modify codeql.yml based on advice
lstruman 164ac43
fix a bug that codeql.yml was put in a wrong directory
lstruman 73033d1
update codeql.yml to pass the PR check
lstruman 9df101b
Potential fix for pull request finding 'CodeQL / Clear-text logging o…
lstruman df0fb2f
Potential fix for pull request finding 'CodeQL / Clear-text logging o…
lstruman d1d7181
Potential fix for pull request finding 'CodeQL / Clear-text logging o…
lstruman 386080b
Potential fix for pull request finding 'CodeQL / Clear-text logging o…
lstruman 0c7d9a0
Potential fix for pull request finding 'CodeQL / Workflow does not co…
lstruman f3f60c5
Potential fix for pull request finding 'CodeQL / Clear-text logging o…
lstruman dbb2aad
Potential fix for pull request finding 'CodeQL / Clear-text logging o…
lstruman e98851e
Potential fix for pull request finding 'CodeQL / Clear-text logging o…
lstruman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: CodeQL | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| analyze: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - uses: github/codeql-action/init@v3 | ||
| with: | ||
| languages: go # ✅ ONLY GO | ||
|
|
||
| - run: go build ./... | ||
|
|
||
| - uses: github/codeql-action/analyze@v3 | ||
| with: | ||
| upload: false # ← ADD THIS LINE | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| /** | ||
| * Copyright 2021 Comcast Cable Communications Management, LLC | ||
| * | ||
| * 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. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package common | ||
|
|
||
| // header X-System-Supported-Docs | ||
| type BitMaskTuple struct { | ||
| GroupBit int | ||
| CpeBit int | ||
| } | ||
|
|
||
| // The group based bitmaps will be merged into 1 cpe bitmap | ||
| // 1: []BitMaskTuple{ // meta_group_id: defined by RDK | ||
| // | ||
| // BitMaskTuple{1, 1}, // {"index_of_bit_from_lsb" for a group bitmap, "index_of_bit_from_lsb" for the cpe bitmap | ||
| var ( | ||
| SupportedDocsBitMaskMap = map[int][]BitMaskTuple{ | ||
| 1: { | ||
| {1, 1}, | ||
| {2, 2}, | ||
| {3, 3}, | ||
| {4, 4}, | ||
| {5, 5}, | ||
| {6, 6}, | ||
| {7, 29}, // connectedbuilding | ||
| {8, 35}, // xmspeedboost | ||
| {9, 40}, // webui | ||
| }, | ||
| 2: { | ||
| {1, 7}, | ||
| {2, 8}, | ||
| {3, 9}, | ||
| }, | ||
| 3: { | ||
| {1, 10}, | ||
| }, | ||
| 4: { | ||
| {1, 11}, | ||
| }, | ||
| 5: { | ||
| {1, 12}, | ||
| }, | ||
| 6: { | ||
| {1, 13}, // mesh | ||
| {2, 31}, // clienttosteeringprofile | ||
| {3, 36}, // meshsteeringprofiles | ||
| {4, 37}, // wifistatsconfig | ||
| {5, 38}, // mwoconfigs | ||
| {6, 39}, // interference | ||
| {7, 34}, // wifimotionsettings | ||
| {8, 41}, // channelplan | ||
| }, | ||
| 7: { | ||
| {1, 14}, | ||
| }, | ||
| 8: { | ||
| {1, 15}, | ||
| {2, 32}, | ||
| {3, 33}, | ||
| }, | ||
| 9: { | ||
| {1, 16}, | ||
| {2, 17}, | ||
| }, | ||
| 10: { | ||
| {1, 18}, | ||
| {2, 19}, | ||
| }, | ||
| 11: { | ||
| {1, 20}, | ||
| {2, 25}, | ||
| }, | ||
| 12: { | ||
| {1, 21}, | ||
| {2, 23}, | ||
| }, | ||
| 13: { | ||
| {1, 22}, | ||
| }, | ||
| 14: { | ||
| {1, 24}, | ||
| }, | ||
| 15: { | ||
| {1, 26}, | ||
| {2, 27}, | ||
| }, | ||
| 16: { | ||
| {1, 28}, | ||
| }, | ||
| 17: { | ||
| {1, 30}, | ||
| }, | ||
| } | ||
| ) | ||
|
|
||
| var ( | ||
| SubdocBitIndexMap = map[string]int{ | ||
| "portforwarding": 1, | ||
| "lan": 2, | ||
| "wan": 3, | ||
| "macbinding": 4, | ||
| "hotspot": 5, | ||
| "bridge": 6, | ||
| "privatessid": 7, | ||
| "homessid": 8, | ||
| "radio": 9, | ||
| "moca": 10, | ||
| "xdns": 11, | ||
| "advsecurity": 12, | ||
| "mesh": 13, | ||
| "aker": 14, | ||
| "telemetry": 15, | ||
| "statusreport": 16, | ||
| "trafficreport": 17, | ||
| "interfacereport": 18, | ||
| "radioreport": 19, | ||
| "telcovoip": 20, | ||
| "wanmanager": 21, | ||
| "voiceservice": 22, | ||
| "wanfailover": 23, | ||
| "cellularconfig": 24, | ||
| "telcovoice": 25, | ||
| "gwfailover": 26, | ||
| "gwrestore": 27, | ||
| "prioritizedmacs": 28, | ||
| "connectedbuilding": 29, | ||
| "lldqoscontrol": 30, | ||
| "clienttosteeringprofile": 31, | ||
| "defaultrfc": 32, | ||
| "rfc": 33, | ||
| "wifimotionsettings": 34, | ||
| "xmspeedboost": 35, | ||
| "meshsteeringprofiles": 36, | ||
| "wifistatsconfig": 37, | ||
| "mwoconfigs": 38, | ||
| "interference": 39, | ||
| "webui": 40, | ||
| "channelplan": 41, | ||
| } | ||
| ) | ||
|
|
||
| func GetDefaultSupportedSubdocMap() map[string]bool { | ||
| m := make(map[string]bool) | ||
| for k := range SubdocBitIndexMap { | ||
| m[k] = false | ||
| } | ||
| return m | ||
| } | ||
|
|
||
| func BuildSupportedSubdocMapWithDefaults(supportedSubdocIds []string) map[string]bool { | ||
| m := make(map[string]bool) | ||
| for k := range SubdocBitIndexMap { | ||
| m[k] = false | ||
| } | ||
| for _, s := range supportedSubdocIds { | ||
| m[s] = true | ||
| } | ||
| return m | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /** | ||
| * Copyright 2021 Comcast Cable Communications Management, LLC | ||
| * | ||
| * 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. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package common | ||
|
|
||
| import ( | ||
| "slices" | ||
| "testing" | ||
|
|
||
| "gotest.tools/assert" | ||
| ) | ||
|
|
||
| func TestGetDefaultSupportedSubdocMap(t *testing.T) { | ||
| m := GetDefaultSupportedSubdocMap() | ||
| assert.Equal(t, len(m), len(SubdocBitIndexMap)) | ||
| } | ||
|
|
||
| func TestBuildSupportedSubdocMapWithDefaults(t *testing.T) { | ||
| supportedSubdocIds := []string{ | ||
| "lan", | ||
| "wan", | ||
| "macbinding", | ||
| "hotspot", | ||
| "privatessid", | ||
| } | ||
| m := BuildSupportedSubdocMapWithDefaults(supportedSubdocIds) | ||
| assert.Equal(t, len(m), len(SubdocBitIndexMap)) | ||
| for k := range m { | ||
| if m[k] { | ||
| assert.Assert(t, slices.Contains(supportedSubdocIds, k)) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.