1 import { Parser } from './Parser';
3 export class VtlParser implements Parser {
4 getVariables(fileContent: string): string[] {
5 const variables: string[] = [];
6 const stringsSlittedByBraces = fileContent.split('${');
7 const stringsDefaultByDollarSignOnly = fileContent.split('"$');
9 for (let i = 1; i < stringsSlittedByBraces.length; i++) {
10 const element = stringsSlittedByBraces[i];
12 const firstElement = element.split('}')[0];
13 if (!variables.includes(firstElement)) {
14 variables.push(firstElement);
16 console.log(firstElement);
21 for (let i = 1; i < stringsDefaultByDollarSignOnly.length; i++) {
22 const element = stringsDefaultByDollarSignOnly[i];
23 if (element && !element.includes('$')) {
24 const firstElement = element.split('"')[0]
26 .replace('}', '').trim();
27 if (!variables.includes(firstElement)) {
28 variables.push(firstElement);
39 <vlb-business-vnf-onap-plugin xmlns="urn:opendaylight:params:xml:ns:yang:vlb-business-vnf-onap-plugin">
42 <ip-addr>$vdns_int_private_ip_0</ip-addr>
43 <oam-ip-addr>$vdns_onap_private_ip_0</oam-ip-addr>
45 <enabled>false</enabled>
49 </vlb-business-vnf-onap-plugin>