Skip to content

Commit

Permalink
Merge pull request #32 from f5devcentral/v1.8.0
Browse files Browse the repository at this point in the history
4/10 work on v1.8.0
  • Loading branch information
DumpySquare authored Apr 10, 2024
2 parents 090d3c0 + cccd7bc commit 6edf74b
Show file tree
Hide file tree
Showing 24 changed files with 520 additions and 155 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ jobs:

- name: publish to open-vsix
run: ovsx publish ${{ env.VSIX_PATH }} -p ${{ secrets.OPEN_VSX_TOKEN }}
# Apr2024: open-vsix has been going through changes recently and things seem to be unstable
# so this step is not critical
continue-on-error: true



Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ dist
tmp
out
cache
project-flipper-*.tgz
vscode-f5-flipper-*.tgz
*.vsix
private*.conf
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ tests
# *.tgz
*.vsix
dist
private
private*
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### Fixed


---

## [1.8.0] - (04-10-2024)

### Fixed

- [BUG] report output blending with previous config #24

### Added

- [RFE] provide easy button for feedback/issues #4
- specify hostname or address with server references
- Added multiple fast templates for different general apps (tcp/udp/http/https)
- this includes being able to select this fast template to convert with in the ns app json view
- added diagnostic rule to identify when a vserver is pointing to another vserver as a -backupVServer
- this should be converted to f5 priority group activation, not multiple vs

---

## [1.7.0] - (04-08-2024)
Expand Down
6 changes: 3 additions & 3 deletions diagnostics.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@
{
"code": "5617",
"severity": "Information",
"title": "",
"message": "",
"regex": ""
"title": "vs references backupVServer",
"message": "In NS points to a backup VS if current pool resources are down, F5 priority group activation is the equivilant",
"regex": " -backupVServer (?<name>(\"[\\S ]+\"|[\\S]+))"
},
{
"code": "4818",
Expand Down
Binary file modified f5_flipper_test.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "F5 Flipper",
"description": "Breaking down Citrix NetScaler ADC configs",
"publisher": "F5DevCentral",
"version": "1.7.0",
"version": "1.8.0",
"keywords": [
"F5",
"F5Networks",
Expand Down Expand Up @@ -77,7 +77,7 @@
"viewsWelcome": [
{
"view": "nsConfigView",
"contents": "Welome to project-flipper!\nThis project aims to explore the process of breaking down, analyzing and abstracting applications from a Citrix NetScaler config/archive (.conf/.tgz)\n- Phase 1: Unpack config\n- Phase 2: Abstract Applications (current)\n- Phase 3: Diagnostics (pending)\n- Phase 4: Conversion Outputs (tmos/xc?/nginx?)\nImport a Citrix ADC/NS config/archive to continue.\n[Import .conf/.tgz from local file](command:f5-flipper.cfgExplore)\n[Load Example/Test NS Config](command:f5-flipper.cfgExploreTest)\n[Repo](https://github.com/f5devcentral/vscode-f5-flipper)"
"contents": "Welome to project-flipper!\nThis project aims to explore the process of breaking down, analyzing and abstracting applications from a Citrix NetScaler config/archive (.conf/.tgz)\n- Phase 1: Unpack config\n- Phase 2: Abstract Applications\n- Phase 3: Diagnostics\n- Phase 4: Conversion Outputs (tmos/as3)\nImport a Citrix ADC/NS config/archive to continue.\n[Import .conf/.tgz from local file](command:f5-flipper.cfgExplore)\n[Load Example/Test NS Config](command:f5-flipper.cfgExploreTest)\n[Repo](https://github.com/f5devcentral/vscode-f5-flipper)\n\nThank you for checking out this tool. Please provide feedback through github issues\n[Open Issue/Bug](https://github.com/f5devcentral/vscode-f5-flipper/issues/new/choose)"
}
],
"commands": [
Expand Down
6 changes: 3 additions & 3 deletions src/CitrixADC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ export default class ADC extends EventEmitter {
.catch(err => {
logger.error(err)
});
// dig each 'add lb vserver', but check for existing?
await digLbVserver(this.configObjectArry, this.rx)

// dig each 'add lb vserver', but check for existing?
await digLbVserver(this.configObjectArry, this.rx)
.then(lbApps => {
// add the lb apps to the main app array
apps.push(...lbApps as AdcApp[])
Expand Down
24 changes: 23 additions & 1 deletion src/codeLens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
workspace
} from "vscode";
import { ext } from "./extensionVariables";
import { globSync } from 'glob';



Expand Down Expand Up @@ -82,7 +83,7 @@ export class NsCodeLensProvider implements CodeLensProvider {
command: 'f5-flipper.convert2AS3',
title: 'Convert to AS3',
tooltip: 'click to convert to AS3',
arguments: [document]
arguments: [{document, template: 'ns/http'}]
}
)
);
Expand All @@ -99,6 +100,27 @@ export class NsCodeLensProvider implements CodeLensProvider {
)
);

// get template directory /templates/as3
// list file names *.yaml
// push a codeLens per file as3/tcp, as3/http, as3/https
const baseDir = path.join(__dirname, '..', 'templates', 'as3');
let filesPaths: string[] = globSync('*.yaml', { cwd: baseDir })

filesPaths.forEach((template) => {
template = template.split('.')[0]
const title = path.join('as3', template);
const thirdLine = new Range(2, 0, 2, 0);
codeLens.push(
new CodeLens(
secondLine,
{
command: 'f5-flipper.convert2AS3',
title,
arguments: [{document, template: title}]
}
)
);
})
}


Expand Down
34 changes: 22 additions & 12 deletions src/digCsVserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function digCsVservers(coa: AdcConfObj, rx: AdcRegExTree) {
const apps: AdcApp[] = [];

// if there are no cs vservers, then return the empty array
if(!coa.add?.cs?.vserver) return apps;
if (!coa.add?.cs?.vserver) return apps;

await Promise.all(coa.add?.cs?.vserver?.map(async vServ => {

Expand Down Expand Up @@ -51,8 +51,10 @@ export async function digCsVservers(coa: AdcConfObj, rx: AdcRegExTree) {
}

// dig 'bind cs vservers'
coa.bind?.cs?.vserver?.filter(el => el.startsWith(app.name))
.forEach(x => {
const csVservers = coa.bind?.cs?.vserver?.filter(el => el.startsWith(app.name))
if (csVservers?.length > 0) {

for await (const x of csVservers) {

const parent = 'bind cs vserver';
const originalString = parent + ' ' + x;
Expand All @@ -74,7 +76,8 @@ export async function digCsVservers(coa: AdcConfObj, rx: AdcRegExTree) {
app.bindings["-lbvserver"].push(opts['-lbvserver'])

}
})
}
}

await digAddCsPolicys(app, coa, rx);
digSslBinding(app, coa, rx);
Expand All @@ -87,11 +90,14 @@ export async function digCsVservers(coa: AdcConfObj, rx: AdcRegExTree) {
export async function digAddCsPolicys(app: AdcApp, obj: AdcConfObj, rx: AdcRegExTree) {

// loop through each policy attached to this app
app.bindings["-policyName"].forEach(policy => {
for await (const policy of app.bindings["-policyName"]) {

// filter out all the policies with this name
obj.add?.cs?.policy?.filter(x => x.startsWith(policy['-policyName']))
.forEach(x => {
const csPolicies = obj.add?.cs?.policy?.filter(x => x.startsWith(policy['-policyName']))

if (csPolicies?.length > 0) {

for await (const x of csPolicies) {
const parent = 'add cs policy';
const originalString = parent + ' ' + x;
app.lines.push(originalString);
Expand All @@ -112,8 +118,10 @@ export async function digAddCsPolicys(app: AdcApp, obj: AdcConfObj, rx: AdcRegEx
if (opts['-action']) {
// 'add cs action <name> '
// get the action config
obj.add.cs.action.filter(el => el.startsWith(opts['-action']))
.forEach(x => {
const csAction = obj.add?.cs?.action?.filter(el => el.startsWith(opts['-action']))
if (csAction?.length > 0) {

for await (const x of csAction) {
const parent = 'add cs action';
const originalString = parent + ' ' + x;
app.lines.push(originalString)
Expand All @@ -128,9 +136,11 @@ export async function digAddCsPolicys(app: AdcApp, obj: AdcConfObj, rx: AdcRegEx
app.csPolicyActions = [];
}
app.csPolicyActions.push(opts)
})
}
}
}
})
}
}

//todo: dig appflow referenced by -policyName
// 'add appflow policy <name>' -> 'add appflow action <name>' -> 'add appflow collector <name>'
Expand Down Expand Up @@ -197,7 +207,7 @@ export async function digAddCsPolicys(app: AdcApp, obj: AdcConfObj, rx: AdcRegEx
})
}
})
})
}

return;
}
Expand Down
Loading

0 comments on commit 6edf74b

Please sign in to comment.