Skip to content

Commit 2a0f002

Browse files
committed
netgear-avline: fixed general mode vlan
1 parent 3b4b903 commit 2a0f002

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/modules/netgear-avline/container/services/interface-setvlantrunk.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ module.exports = async (port, untaggedVlan = 1, taggedVlans = []) => {
4848
// pull out the keys we need
4949
const newConfig = {
5050
dot1q_sw_port_config: {
51-
accessVlan: portConfig.dot1q_sw_port_config.accessVlan,
51+
accessVlan: untaggedVlan,
5252
allowedVlanList: expandedVlans,
53-
configMode: "trunk",
53+
configMode: "general",
5454
nativeVlan: untaggedVlan,
5555
}
5656
}
@@ -69,7 +69,7 @@ module.exports = async (port, untaggedVlan = 1, taggedVlans = []) => {
6969
const interfacesCollection = await mongoCollection("interfaces");
7070
const dbResult = await interfacesCollection.updateOne(
7171
{ port: parseInt(port) },
72-
{ $set: { "tagged-vlans": filteredVlans, configMode: "trunk", "untagged-vlan": portConfig.dot1q_sw_port_config.accessVlan } }
72+
{ $set: { "tagged-vlans": filteredVlans, configMode: "general", "untagged-vlan": untaggedVlan } }
7373
);
7474
console.log(`interface-setvlantrunk: ${JSON.stringify(dbResult.result)}`);
7575
return true;

src/modules/netgear-avline/container/utils/netgear-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ module.exports = class NetgearAPI {
9696
try {
9797
const response = await axios.get(url, {
9898
httpsAgent: this.agent,
99-
timeout: 5000,
99+
timeout: 6000,
100100
headers: { Authorization: `Bearer ${token}` },
101101
});
102102

src/modules/netgear-avline/container/utils/poller-interfacevlans.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
22

33
const mongoSingle = require("@core/mongo-single");
4+
const delay = require("delay");
45

56
module.exports = async (NetgearApi, interfacesCollection) => {
67

@@ -11,7 +12,6 @@ module.exports = async (NetgearApi, interfacesCollection) => {
1112
const interfaces = await interfacesCollection.find().toArray();
1213

1314
for (let eachInterface of interfaces) {
14-
1515
const fieldsToUpdate = {};
1616

1717
const result = await NetgearApi.get({ path: `dot1q_sw_port_config?interface=${eachInterface.port}` });
@@ -27,6 +27,10 @@ module.exports = async (NetgearApi, interfacesCollection) => {
2727
fieldsToUpdate["untagged-vlan"] = result.dot1q_sw_port_config?.nativeVlan;
2828
fieldsToUpdate["tagged-vlans"] = result.dot1q_sw_port_config?.allowedVlanList?.filter((v) => availableVlans.includes(parseInt(v))).map((v) => parseInt(v));
2929
}
30+
else if (result.dot1q_sw_port_config.configMode === "general") {
31+
fieldsToUpdate["untagged-vlan"] = result.dot1q_sw_port_config?.nativeVlan;
32+
fieldsToUpdate["tagged-vlans"] = result.dot1q_sw_port_config?.allowedVlanList?.filter((v) => availableVlans.includes(parseInt(v))).map((v) => parseInt(v));
33+
}
3034

3135
}
3236

@@ -38,5 +42,7 @@ module.exports = async (NetgearApi, interfacesCollection) => {
3842
{ $set: fieldsToUpdate }
3943
);
4044

45+
await delay(5000);
46+
4147
}
4248
}

0 commit comments

Comments
 (0)