SSH Into Cloud Key, or Machine with Cloud controller's Mongo Shell:
ssh admin@<cloudkey-ip> -t mongo localhost:27117
Then you can use the following snippet tailoring it to your needs:
SSH Into Cloud Key, or Machine with Cloud controller's Mongo Shell:
ssh admin@<cloudkey-ip> -t mongo localhost:27117
Then you can use the following snippet tailoring it to your needs:
| // To list all switch profiles: | |
| db.getSiblingDB('ace').getCollection('portconf').find({}) | |
| // OUTPUT EXAMPLE: | |
| // { "_id" : ObjectId("5e9759d1f08ae3048a688c17"), "native_networkconf_id" : "5ad56c29f08ae301eb96a11c", "attr_no_edit" : true, "name" : "LAN_002_Main", "forward" : "native", "site_id" : "5ad56675f08ae301ea09c7b5", "isolation" : false } | |
| // { "_id" : ObjectId("5e978a46f08ae3048a6af621"), "dot1x_ctrl" : "force_authorized", "native_networkconf_id" : "5ad5667af08ae301ea09c7bf", "voice_networkconf_id" : "", "autoneg" : true, "lldpmed_enabled" : true, "stp_port_mode" : true, "egress_rate_limit_kbps_enabled" : false, "name" : "ttt", "forward" : "native", "tagged_networkconf_ids" : [ ], "site_id" : "5ad56675f08ae301ea09c7b5" } | |
| // To convert a particular Switch Profile: | |
| // This will: | |
| // - delete extra fields | |
| // (the ones not present in Network Switch Profiles) | |
| // - set `attr_no_edit` to true | |
| // (seems to be the attribute that UniFi UI is filtering on) | |
| // - and rename the profile | |
| // (optionally, if you like your NetSwitchProfiles to match the Network they were created for) | |
| // and this should be enough to make UniFi think that it is a Network Profile. | |
| // [Certified: Works on my machine (tm). Use at your own risk!] | |
| db.getSiblingDB('ace').getCollection('portconf').findAndModify({ | |
| query: { | |
| // Either use the id (name: "ttt" in example output): | |
| _id: ObjectId("5e978a46f08ae3048a6af621") | |
| // or (name of the profile you want to rename from either the list from CMD you ran before or GUI): | |
| name: "ttt", | |
| }, | |
| update: { | |
| $set: { | |
| // Uncomment this line to rename: | |
| // "name": "TEST_PROFILE_1", | |
| "attr_no_edit": true, | |
| }, | |
| $unset: { | |
| "autoneg" : "", | |
| "dot1x_ctrl" : "", | |
| "voice_networkconf_id" : "", | |
| "lldpmed_enabled" : "", | |
| "stp_port_mode" : "", | |
| "egress_rate_limit_kbps_enabled" : "", | |
| "tagged_networkconf_ids": "", | |
| } | |
| } | |
| }) |