mirror of
				https://github.com/nttgin/BGPalerter.git
				synced 2024-05-19 06:50:08 +00:00 
			
		
		
		
	added feature to recover description from previous prefixes.yml
This commit is contained in:
		@@ -252,17 +252,15 @@ export default class Input {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                inputParameters.logger = (message) => {
 | 
					                inputParameters.logger = (message) => {
 | 
				
			||||||
                    this.logger.log({
 | 
					                    // Nothing, ignore logs in this case (too many otherwise)
 | 
				
			||||||
                        level: 'info',
 | 
					 | 
				
			||||||
                        message
 | 
					 | 
				
			||||||
                    });
 | 
					 | 
				
			||||||
                };
 | 
					                };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return generatePrefixes(inputParameters)
 | 
					                return generatePrefixes(inputParameters)
 | 
				
			||||||
                    .then(newPrefixList => {
 | 
					                    .then(newPrefixList => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        const newPrefixes = [];
 | 
					                        const newPrefixes = [];
 | 
				
			||||||
                        const uniquePrefixes = [...new Set(Object.keys(oldPrefixList).concat(Object.keys(newPrefixList)))];
 | 
					                        const uniquePrefixes = [...new Set(Object.keys(oldPrefixList).concat(Object.keys(newPrefixList)))]
 | 
				
			||||||
 | 
					                            .filter(prefix => ipUtils.isValidPrefix(prefix));
 | 
				
			||||||
                        const asns = [...new Set(Object
 | 
					                        const asns = [...new Set(Object
 | 
				
			||||||
                            .values(oldPrefixList)
 | 
					                            .values(oldPrefixList)
 | 
				
			||||||
                            .map(i => i.asn)
 | 
					                            .map(i => i.asn)
 | 
				
			||||||
@@ -272,6 +270,11 @@ export default class Input {
 | 
				
			|||||||
                            const oldPrefix = oldPrefixList[prefix];
 | 
					                            const oldPrefix = oldPrefixList[prefix];
 | 
				
			||||||
                            const newPrefix = newPrefixList[prefix];
 | 
					                            const newPrefix = newPrefixList[prefix];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            // Apply old description to the prefix
 | 
				
			||||||
 | 
					                            if (newPrefix && oldPrefix) {
 | 
				
			||||||
 | 
					                                newPrefix.description = oldPrefix.description;
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            // The prefix didn't exist
 | 
					                            // The prefix didn't exist
 | 
				
			||||||
                            if (newPrefix && !oldPrefix) {
 | 
					                            if (newPrefix && !oldPrefix) {
 | 
				
			||||||
                                // The prefix is not RPKI valid
 | 
					                                // The prefix is not RPKI valid
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user