An approach to resilience of interconnected systems based on stability analysis