mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-09 18:20:46 +08:00
Ship capability groups (nms/common/topology) with shared netx skills.
One group maps to one skill and tools-*; rename NMS tools to *Nms*; sync playbooks from netx/skills. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
83c3796fbb
commit
3c9a383071
47 changed files with 11790 additions and 680 deletions
70
test/capability-groups.test.mjs
Normal file
70
test/capability-groups.test.mjs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* Capability-group defaults and plane filters.
|
||||
*/
|
||||
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
|
||||
import {
|
||||
capabilityGroupsFromSettings,
|
||||
DEFAULT_CAPABILITY_GROUPS,
|
||||
groupsForPlane,
|
||||
groupsForced,
|
||||
SKILL_DIR_BY_GROUP,
|
||||
toolNamesForGroups,
|
||||
TOOLS_BY_GROUP,
|
||||
} from '../src/netx/capability-groups.ts'
|
||||
|
||||
test('defaults: nms + common in preset; topology and public off', () => {
|
||||
assert.deepEqual(DEFAULT_CAPABILITY_GROUPS, {
|
||||
nms: { inPreset: true, public: false },
|
||||
common: { inPreset: true, public: false },
|
||||
topology: { inPreset: false, public: false },
|
||||
})
|
||||
assert.deepEqual(groupsForPlane(undefined, 'preset'), ['nms', 'common'])
|
||||
assert.deepEqual(groupsForPlane(undefined, 'public'), [])
|
||||
})
|
||||
|
||||
test('one group one skill dir; topology owns canvas + layout tools', () => {
|
||||
assert.deepEqual(SKILL_DIR_BY_GROUP, {
|
||||
nms: 'nms',
|
||||
common: 'common',
|
||||
topology: 'topology',
|
||||
})
|
||||
assert.ok(TOOLS_BY_GROUP.common.includes('netx__findTopologyPaths'))
|
||||
assert.ok(TOOLS_BY_GROUP.topology.includes('netx__getTopologyTree'))
|
||||
assert.ok(TOOLS_BY_GROUP.topology.includes('netx__layoutTopologyView'))
|
||||
assert.ok(TOOLS_BY_GROUP.topology.includes('netx__suggestSinkHubs'))
|
||||
assert.ok(TOOLS_BY_GROUP.topology.includes('netx__sinkTopologyDualUnits'))
|
||||
assert.ok(TOOLS_BY_GROUP.nms.includes('netx__queryNmsAlarms'))
|
||||
})
|
||||
|
||||
test('capabilityGroupsFromSettings honors explicit false for inPreset defaults', () => {
|
||||
const groups = capabilityGroupsFromSettings({
|
||||
groupNmsInPreset: false,
|
||||
groupCommonInPreset: false,
|
||||
groupTopologyInPreset: true,
|
||||
groupTopologyPublic: true,
|
||||
})
|
||||
assert.deepEqual(groupsForPlane(groups, 'preset'), ['topology'])
|
||||
assert.deepEqual(groupsForPlane(groups, 'public'), ['topology'])
|
||||
assert.ok(toolNamesForGroups(['topology']).has('netx__layoutTopologyView'))
|
||||
assert.ok(toolNamesForGroups(['topology']).has('netx__sinkTopologyDualUnits'))
|
||||
assert.equal(toolNamesForGroups(['topology']).has('netx__queryNmsAlarms'), false)
|
||||
})
|
||||
|
||||
test('legacy groupManagedNe* maps to common; legacy layout flags OR into topology', () => {
|
||||
const groups = capabilityGroupsFromSettings({
|
||||
groupManagedNeInPreset: false,
|
||||
groupManagedNePublic: true,
|
||||
groupTopologyLayoutInPreset: true,
|
||||
})
|
||||
assert.equal(groups.common.inPreset, false)
|
||||
assert.equal(groups.common.public, true)
|
||||
assert.equal(groups.topology.inPreset, true)
|
||||
})
|
||||
|
||||
test('groupsForced ignores settings for per-export mounts', () => {
|
||||
assert.deepEqual(groupsForced(['common']), ['common'])
|
||||
assert.deepEqual(groupsForced(['nms', 'topology']), ['nms', 'topology'])
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue